Skip to content
Browse docs

Connecting to DuckDB on Layerbase Cloud

Layerbase Cloud runs DuckDB behind a PostgreSQL-compatible endpoint for analytics workloads that need a hosted SQL connection.

Best for: Ad hoc analytics, small data warehouses, CSV/Parquet workflows, and teams that want DuckDB without managing a server.

1

Open your database in the dashboard

Go to /cloud, click the database you just created, and the connection panel shows the host, port, username, password, and a ready-to-paste connection string for the engine.

Copy the Postgres-style DuckDB URL from Quick Connect.

If a password leaks, the database owner can replace it with Rotate password under Connection parameters in the Connect dialog, on PostgreSQL, MySQL, MariaDB, Redis, and Valkey. The old password stops working at once, the connection string and any HTTP API token change with it, and connections that are already open stay connected. Update every app and environment variable that holds the old value. Branches keep their own passwords.

You can also download the whole set instead of copying values one at a time: the Connect dialog offers a Download .env file, ready to drop into a project under the environment variable your engine's clients expect, and a Download .txt with the labeled parameters. Both files contain the password in plain text, so keep them out of version control.

2

TLS is required, on by default

Append ?sslmode=require.

PostgreSQL-compatible proxy on port 5432

3

Use any standard client

DuckDB works with the normal client family for that engine. Start with the dashboard snippet, then move the same URL and credentials into your app environment.

If your client has separate direct, pooled, TLS, or HTTP options, prefer the exact variant shown in Quick Connect.

bashDuckDB
psql "postgresql://layerbase:password@your-host.cloud.layerbase.dev:5432/duck1?sslmode=require"

DuckDB notes

  • Use PostgreSQL-compatible tools for the connection, then write DuckDB SQL.
  • On DuckDB 2, the owner can also enable a native DuckDB connection from the Native DuckDB tab in Connect: a snippet for a DuckDB client that installs the Quack extension and attaches the database over HTTPS with a token. The DuckDB guide (/docs/engines/duckdb) covers it.
  • For embedded-only analytics, local DuckDB may still be simpler.