|
35 | 35 | then a notebook `docs/example.html` can access any database configured in <code>docs/<wbr>.observable/<wbr>databases.json</code>. In the future, Observable Desktop will provide a built-in UI for configuring databases.
|
36 | 36 | </script>
|
37 | 37 | <script id="15" type="text/markdown">
|
38 |
| - **Which databases are supported?** Currently DuckDB, SQLite, Snowflake, and Postgres (PostgreSQL). The Postgres driver should also work with Postgres-compatible databases such as ClickHouse, Amazon Redshift, and Google Cloud SQL. We plan on adding more data connectors soon, notably Google BigQuery and Databricks. Our data connectors are [open-source](https://github.com/observablehq/notebook-kit/tree/main/src/databases) and we welcome contributions of additional database drivers! While you can query OLTP databases, we recommend OLAP databases because fast _ad hoc_ queries greatly accelerate analysis. |
| 38 | + **Which databases are supported?** The following databases are supported, along with their current drivers: |
| 39 | + |
| 40 | + * DuckDB - [@duckdb/node-api](https://www.npmjs.com/package/@duckdb/node-api) |
| 41 | + * SQLite - [node:sqlite](https://nodejs.org/api/sqlite.html) or [bun:sqlite](https://bun.com/docs/api/sqlite) |
| 42 | + * Snowflake - [snowflake-sdk](https://www.npmjs.com/package/snowflake-sdk) |
| 43 | + * Postgres - [postgres](https://www.npmjs.com/package/postgres) |
| 44 | + * Google BigQuery - [@google-cloud/bigquery](https://www.npmjs.com/package/@google-cloud/bigquery) |
| 45 | + * Databricks - [@databricks/sql](https://www.npmjs.com/package/@databricks/sql) |
| 46 | + |
| 47 | + The Postgres (PostgreSQL) driver should also work with Postgres-compatible databases such as ClickHouse, Amazon Redshift, and Google Cloud SQL. Our data connectors are [open-source](https://github.com/observablehq/notebook-kit/tree/main/src/databases) and we welcome contributions of additional database drivers! While you can query OLTP databases, we recommend OLAP databases because fast _ad hoc_ queries greatly accelerate analysis. |
39 | 48 | </script>
|
40 | 49 | <script id="35" type="text/markdown">
|
41 | 50 | **How do I query my database?** Insert a new cell, say by clicking the <b>+</b> button between cells. Convert the new cell to SQL by hitting down or <span style="font-family: var(--sans-serif);">⌘4</span>. By default, SQL cells query the default `duckdb` in-memory database. To query a different database, edit the **database** in the cell toolbar, then click ↩︎ or hit <span style="font-family: var(--sans-serif);">return</span>. Then refocus the SQL cell, edit your query, and hit <span style="font-family: var(--sans-serif);">shift-return</span> to run it.
|
|
170 | 179 | ```sh
|
171 | 180 | npm add snowflake-sdk
|
172 | 181 | ```
|
| 182 | + |
| 183 | + To install the Google BigQuery driver: |
| 184 | + |
| 185 | + ```sh |
| 186 | + npm add @google-cloud/bigquery |
| 187 | + ``` |
| 188 | + |
| 189 | + To install the Databricks driver: |
| 190 | + |
| 191 | + ```sh |
| 192 | + npm add @databricks/sql |
| 193 | + ``` |
173 | 194 | </script>
|
174 | 195 | <script id="46" type="text/markdown">
|
175 | 196 | **What is the format of the `databases.json` file?** This file can configure multiple databases. Each database must have a unique name, the database type, and any corresponding configuration options. Here is how you might configure a `demo` Snowflake database:
|
|
249 | 270 |
|
250 | 271 | See the [Snowflake Node.js driver documentation](https://docs.snowflake.com/en/developer-guide/node-js/nodejs-driver-authenticate) for details.
|
251 | 272 | </script>
|
| 273 | + <script id="66" type="text/markdown"> |
| 274 | + **How do I configure Google BigQuery?** The following options are supported: |
| 275 | + |
| 276 | + ```ts |
| 277 | + type BigQueryConfig = { |
| 278 | + type: "bigquery"; |
| 279 | + apiKey?: string; |
| 280 | + keyFilename?: string; |
| 281 | + keyFile?: string; |
| 282 | + projectId?: string; |
| 283 | + } |
| 284 | + ``` |
| 285 | + |
| 286 | + See the [Google Cloud SDK documentation](https://cloud.google.com/docs/authentication/set-up-adc-local-dev-environment) for details. |
| 287 | + </script> |
| 288 | + <script id="67" type="text/markdown"> |
| 289 | + **How do I configure Databricks?** The following options are supported: |
| 290 | + |
| 291 | + ```ts |
| 292 | + type DatabricksConfig = { |
| 293 | + type: "databricks"; |
| 294 | + host: string; |
| 295 | + path: string; |
| 296 | + } & ( |
| 297 | + | {authType?: "access-token"; token: string} |
| 298 | + | {authType: "databricks-oauth"; oauthClientId?: string; oauthClientSecret?: string} |
| 299 | + ) |
| 300 | + ``` |
| 301 | + |
| 302 | + See the [Databricks SQL Driver for Node.js documentation](https://docs.databricks.com/aws/en/dev-tools/nodejs-sql-driver#authentication) for details. |
| 303 | + </script> |
252 | 304 | </notebook>
|
0 commit comments