Esc
Documentation
On this page

The DuckDB adapter opens a DuckDB database on the machine that runs DSUI, or attaches one in cloud storage or on a DuckDB server. It has several connection methods, so you must set method on every service.

Add a DuckDB service#

Declare the adapter and the service in dsui.yaml. This example opens a database file:

yaml
adapters:
  duckdb:
    source: git
    repository: "git+https://github.com/northgraindata/dsui"
    path: packages/adapter-duckdb

services:
  - id: warehouse
    adapter: duckdb
    name: Analytics warehouse
    connection:
      method: file
      path: /data/warehouse.duckdb

The path is on the machine that runs DSUI, not in your browser. In Docker, mount the directory into the container first. See run DSUI with Docker.

Connection methods#

Choose one method. Every method also accepts readOnly, which defaults to false. When it’s true, DuckDB opens the database in read-only mode.

In-memory and file#

MethodFieldsMeaning
memoryAn empty database that exists only while DSUI holds the connection
filepath (required)A .duckdb file on the server’s filesystem

DuckDB lets only one process hold a database file at a time. If another process has the file open, DSUI reports that the database file is locked. Close the other connection and try again. DSUI also runs requests to a file service one after another, not in parallel.

Cloud storage#

These methods open the database at url and create a DuckDB secret from the credential fields. All credential fields are optional.

MethodStorageurl schemeCredential fields
s3S3, MinIO, and other S3-compatible storages3: or https:s3AccessKeyId, s3SecretAccessKey, s3SessionToken, s3Region, s3Endpoint
gcsGoogle Cloud Storage, through its S3 API with HMAC keysgcs:, gs:, or https:gcsKeyId, gcsSecret
r2Cloudflare R2r2: or https:r2KeyId, r2Secret, r2AccountId
azureAzure Blob Storageaz:, azure:, or https:connectionString

url is required for all of them. For example, url: "s3://your_bucket/warehouse.duckdb".

DuckDB server#

MethodFieldsMeaning
quackuri, token, disableSslA remote DuckDB instance served over HTTP

uri must start with quack: and defaults to quack:localhost. token authenticates DSUI to the server. disableSsl defaults to false, so reads use HTTPS unless you set it to true.

What you can do#

  • Data: browse databases, schemas, tables, views, sequences, indexes, macros, functions, and types. Open a table to see its columns, a preview of its rows, and its DDL
  • Query: write and run SQL, and cancel a running query. DSUI keeps a history of the queries you run
  • Notebooks: create, save, duplicate, import, and delete notebooks
  • Extensions: install, load, unload, and reload DuckDB extensions
  • Settings and secrets: set and reset DuckDB settings, and create and drop secrets
  • Changes: attach and detach databases, create and drop schemas, tables, views, and indexes, and import data

Signals#

Running a query in DSUI emits the signal query-succeeded or query-failed. The payload holds the operation, the duration in milliseconds, and the row count or the error code. It never includes the query text. DSUI keeps the query history, so queries that other clients run don’t emit signals.

Use with a DSUI Agent#

Remote DuckDB methods aren’t verified to work through a DSUI Agent. The adapter doesn’t read the proxy variables that DSUI sets for one. See private networks.