Skip to content

Commit 55a025c

Browse files
committed
document BigQuery and Databricks connectors
1 parent 584d57a commit 55a025c

File tree

2 files changed

+66
-2
lines changed

2 files changed

+66
-2
lines changed

docs/databases.html

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,16 @@
3535
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.
3636
</script>
3737
<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.
3948
</script>
4049
<script id="35" type="text/markdown">
4150
**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,6 +179,18 @@
170179
```sh
171180
npm add snowflake-sdk
172181
```
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+
```
173194
</script>
174195
<script id="46" type="text/markdown">
175196
**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,4 +270,35 @@
249270

250271
See the [Snowflake Node.js driver documentation](https://docs.snowflake.com/en/developer-guide/node-js/nodejs-driver-authenticate) for details.
251272
</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>
252304
</notebook>

docs/kit.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@
5050
npm add snowflake-sdk
5151
```
5252

53+
To install the Google BigQuery driver:
54+
55+
```sh
56+
npm add @google-cloud/bigquery
57+
```
58+
59+
To install the Databricks driver:
60+
61+
```sh
62+
npm add @databricks/sql
63+
```
64+
5365
Notebook Kit requires [Node.js](https://nodejs.org/en) 20.19+ or 22.12+. To use the SQLite database connector, you must use Node.js 24+. [Bun](https://bun.com/) 1.2+ should also work, but is not officially supported.
5466
</script>
5567
<script id="47" type="text/markdown">
@@ -323,7 +335,7 @@ <h1>Hello, <i>world</i>!</h1>
323335
The Vite plugin is recommended for Vite-based applications.
324336
</script>
325337
<script id="42" type="text/markdown">
326-
#### <code class="language-ts">observable({template?: string, transformTemplate?: (template: string) => string | Promise&lt;string&gt;, transformNotebook?: (notebook: Notebook) => Notebook | Promise&lt;Notebook&gt;}, window?: Window, parser?: DOMParser): PluginOption</code>
338+
#### <code class="language-ts">observable({template?: string, transformTemplate?: (template: string) => string | Promise&lt;string&gt;, transformNotebook?: (notebook: Notebook) => Notebook | Promise&lt;Notebook&gt;, window?: Window, parser?: DOMParser} = {}): PluginOption</code>
327339

328340
Returns a Vite plugin for rendering notebook HTML as vanilla HTML. Markdown and HTML cells are rendered statically (without any interpolated dynamic values), and then, if needed, replaced with dynamic content when the page loads. Other cell modes are exclusively dynamic. Pinned cells display their source code statically rendered below any output. Supported languages are syntax-highlighted using Lezer.
329341
</script>

0 commit comments

Comments
 (0)