Skip to main content

Attach to a DuckDB Database over HTTPS or S3

You can establish a read-only connection to a DuckDB database via HTTPS or the S3 API. Access over HTTP(S) and S3 is built into SereneDB.

Attaching to a Database over HTTPS

To connect to a DuckDB database via HTTPS, use the ATTACH statement as follows:

Query
ATTACH 'https://blobs.duckdb.org/databases/stations.duckdb' AS stations_db;

Then, the database can be queried using:

Query
SELECT count(*) AS num_stationsFROM db111.stations;
Result
 num_stations--------------            2

Attaching to a Database over the S3 API

To connect to a DuckDB database via the S3 API, configure the authentication for your bucket (if required). Then, use the ATTACH statement as follows:

Query
ATTACH 's3://my-bucket/stations.duckdb' AS stations_db;

The database can be queried using:

Query
SELECT count(*) AS num_stationsFROM db112.stations;
DETACH IF EXISTS db112;
DETACH IF EXISTS db111;
Result
 num_stations--------------            2

Limitations

  • Only read-only connections are allowed, writing the database via the HTTPS protocol or the S3 API is not possible.