hasura / hasura/graphql-engine
docs/bigquery: connecting to a bigquery project
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
The following are required by graphql-engine to connect to a BigQuery project.
1. [Project Id](https://support.google.com/googleapi/answer/7014113?hl=en)
2. The [datasets](https://cloud.google.com/bigquery/docs/datasets-intro) that can be exposed over graphql - these have to be explicitly listed.
3. A [Service Account](https://cloud.google.com/iam/docs/service-accounts) to query the project.
## Creating a service account
1. In google cloud's console, head to your bigquery project.
2. IAM and Admin > Service Accounts > Create Service Account
3. Give it a name, and under roles, and grant these 3 roles: 'Bigquery Metadata Viewer', 'BigQuery Data Viewer' and 'BigQuery Job User'.

4. Click on the created service account, Keys > ADD KEY > Create New Key > JSON > Create. This will download a service account file on your computer.
## Connecting to a BigQuery project
1. Run graphql-engine with an environment variable set to the contents of the service account. This maybe done as follows if you are using docker:
```
docker run -e BIGQUERY_SA_ACCOUNT=$(cat /path/to/the/service-account.json)
```
2. Head to the console, in the 'Connect Existing Database' page, choose 'Environment Variable' under 'Connect Via', and fill in the necessary details:

Contributor guide
Assessment
This issue has not been assessed yet.