# BigQuery

## Configuration

The BigQuery configurations are:

* `creds`: the path to the Google authentication credentials. The default is the environment variable `GOOGLE_APPLICATION_CREDENTIALS`.

For more information, see here the [Google BigQuery documentation](https://cloud.google.com/bigquery/docs/reference/libraries).

```yaml
# profile.yml

<profile name here>: # change this!
  adapters:
    <bigquery adapter name here>: # change this!
      type: bigquery
      creds: '{{ env("GOOGLE_APPLICATION_CREDENTIALS") }}'

```

Under the hood, prism interacts with the BigQuery Python API to create the SQL engine.

## `hooks.sql()`

You can run queries against the BigQuery engine using the `hooks.sql` function:

```python
def run(self, tasks, hooks):
    data = hooks.sql(
        adapter_name="<bigquery adapter name>",
        query="SELECT * FROM table"
    )
```

Note that when `return_type = None`, the result will be a list of [`Row`](https://cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.table.Row) objects containing the query data.
