Prerequisites
Before proceeding, ensure the following prerequisites are met:- Install MindsDB locally via Docker or use MindsDB Cloud.
- To connect Google BigQuery to MindsDB, install the required dependencies following this instruction.
- Install or ensure access to Google BigQuery.
Implementation
This handler is implemented using thegoogle-cloud-bigquery Python library.
The required arguments to establish a connection are as follows:
project_idis a globally unique identifier for your project.datasetdefines the default dataset. Tables from this dataset are shown in the object tree.service_account_keysis a full path to the service account key file. This parameter is required but can be replaced byservice_account_json.service_account_jsonstores the content of a JSON file defined by theservice_account_keysparameter. This parameter is required whenservice_account_keysis not provided.
Usage
In order to make use of this handler and connect to the BigQuery database in MindsDB, the following syntax can be used:You can use either the
service_account_keys parameter or the service_account_json parameter.If you use MindsDB Cloud, it is recommended to provide the service_account_json parameter, as in the example below.If you use local installation of MindsDB, you can provide either the service_account_keys parameter or the service_account_json parameter, as in the example below.You can use this established connection to query your dataset as follows: