Skip to content

DuckDB Extension

ADBC Scanner

ADBC (Arrow Database Connectivity) is a standard API for database drivers that exchange data in Apache Arrow format. ADBC Scanner connects DuckDB to databases through these drivers, so you can query remote data and join it with local tables.

449,011
extension loads · last 90 days
On this page

Connect through a database driver

An ADBC driver handles the connection to a particular database, such as SQLite, PostgreSQL, or a Flight SQL service. ADBC Scanner loads that driver into DuckDB and exposes the connection through ATTACH. You can browse remote tables, send SQL to the remote database, and join the results with local data.

Use it when an ADBC driver is available for your source. The driver supplies results in Arrow batches; its network protocol and supported operations depend on the database. Install the driver separately from this extension. The SQLite example below shows both parts of that setup.

Example

Query an in-memory SQLite database

Attach SQLite through its ADBC driver and query a constant with an explicit result schema.

Before you run it: Install the SQLite driver with dbc install sqlite before running the SQL. The setup instructions cover installing dbc and updating the extension. This example uses DuckDB 1.5.6 and ADBC Scanner build 9723c3c from the community repository.

Run this example in the DuckDB CLI or a native client.

INSTALL adbc_scanner FROM community;
LOAD adbc_scanner;

ATTACH ':memory:' AS qf_sqlite (TYPE adbc, driver 'sqlite');
SELECT * FROM adbc_scan(
  'qf_sqlite', 'SELECT 1 AS id', columns := {'id': 'BIGINT'}
);
DETACH qf_sqlite;

A successful query returns one row with id = 1. If your installed extension still uses adbc_connect, update it before running this example.

Common tasks

Deep Dive

Technical Details

Reference

Extension Contents

Quick reference to all available functions and settings organized by category.

ADBC Catalog
adbc Object type: Catalog Attach an ADBC database as a DuckDB catalog with table discovery, supported projection/filter pushdown, and Arrow result streams.
Connection
adbc_clear_cache() Object type: Table function Use CALL to invalidate schema and table metadata for attached ADBC catalogs after remote DDL.
adbc_info() Object type: Table function Return driver and server metadata for an attached ADBC database — vendor name, version strings, supported features.
adbc_profiles() Object type: Table function List locally discoverable ADBC connection profiles.
Database Connection
adbc Object type: Secret Stored credentials and connection details for ADBC drivers.
Mutation
adbc_execute() Object type: Table function Use standalone CALL to execute remote DDL or DML at runtime on an attached ADBC database.
adbc_insert() Object type: Table function Pass a DuckDB query's Arrow batches to the driver's bulk ingestion API.
Query
adbc_remote_query() Object type: Table function DuckDB 2.0 only.
adbc_scan() Object type: Table function Run SQL on an attached ADBC database and stream its result as a DuckDB table.
adbc_scan_table() Object type: Table function Read a named table using GetTableSchema metadata and a generated SELECT with supported projection and filter pushdown.
Schema
adbc_columns() Object type: Table function Describe the columns of a table — name, type, nullability, default — pulled from the driver's catalog API.
adbc_schema() Object type: Table function Describe a named table through the driver's GetTableSchema metadata API.
adbc_table_types() Object type: Table function List the table-type categories the driver/server distinguishes (e.g.
adbc_tables() Object type: Table function List tables visible to an attached ADBC database.

API Reference

Function Reference

Database Storage

Storage Extensions

Catalog implementations that attach external storage as a DuckDB database.

adbc

Description
Parameters
Parameter Type Required Description
driver VARCHAR Optional Driver name resolved through installed manifests, or shared-library path. Required unless supplied by a secret or profile.
uri VARCHAR Optional Connection URI passed to the driver, overriding the ATTACH path. Use it for http:///https:// URIs.
entrypoint VARCHAR Optional Custom driver entrypoint function name. Only needed for drivers that don't follow the standard AdbcDriverInit symbol convention.
search_paths VARCHAR Optional Extra colon-separated directories to look in for ADBC driver manifests (*.toml) and connection profiles, in addition to the platform defaults.
profile VARCHAR Optional Name of an ADBC connection profile supplying the driver and options. Equivalent to an ATTACH path of profile://<name>.
use_manifests VARCHAR Optional Default: true Set to 'false' to skip manifest resolution entirely (load the driver only by absolute path).
batch_size INTEGER Optional Hint for the number of rows per Arrow batch when scanning. Larger values reduce per-batch overhead at the cost of memory.
secret VARCHAR Optional Name of an ADBC secret containing driver and connection options. Without it, a secret whose scope prefixes the ATTACH path's URI is used automatically.
default_schema VARCHAR Optional Schema that unqualified names (db.orders, or orders after USE db) resolve to. Without it, the schema the connection reports as current is used if the catalog lists it, else the only schema listed, else main.
query_pushdown BOOLEAN Optional Default: true DuckDB 2.0 only. Set to false to stop whole queries against this attachment from being pushed down as one remote statement; scans still push down projections and filters.
Examples
1
ATTACH 'users.sqlite' AS db (TYPE adbc, driver 'sqlite');
CALL adbc_execute('db', 'DROP TABLE IF EXISTS users');
CALL adbc_execute('db', 'CREATE TABLE users(id INTEGER, name TEXT)');
BEGIN;
CALL adbc_execute('db', 'INSERT INTO users VALUES (1, ''Alice'')');
COMMIT;
BEGIN;
CALL adbc_execute('db', 'INSERT INTO users VALUES (2, ''Bob'')');
ROLLBACK;
SELECT * FROM adbc_scan_table('db', 'users'); -- Alice only
DETACH db;
2
ATTACH 'postgresql://reader@localhost/analytics' AS pg (
  TYPE adbc, READ_ONLY, driver 'postgresql'
);
SELECT user_id, COUNT(*) AS events
FROM pg.public.activity
WHERE ts >= CURRENT_DATE - 7
GROUP BY user_id;
DETACH pg;
3
ATTACH '/data/app.db' AS local_app (TYPE adbc, READ_ONLY, driver 'sqlite');
SHOW TABLES FROM local_app.main;
DETACH local_app;
4
ATTACH 'profile://mydb' AS mydb (TYPE adbc);
SELECT * FROM adbc_info('mydb');
DETACH mydb;

Security

Secrets

DuckDB secrets for storing the credentials and keys used by the adbc scanner extension.

adbc

Description
Parameters
Parameter scope Type VARCHAR Required Optional Description URI prefix identifying the secret's scope. Defaults to URI when omitted; a secret with neither is rejected. Set it explicitly to match a different or broader prefix.
Parameter driver Type VARCHAR Required Required Description ADBC driver name (e.g. 'sqlite', 'postgresql') or path to a shared library.
Parameter uri Type VARCHAR Required Optional Description Connection URI passed to the driver. Driver-specific format.
Parameter username Type VARCHAR Required Optional Description Database username.
Parameter password Type VARCHAR Required Optional Description Database password. This field is redacted in DuckDB's secret display, not necessarily in SQL logs.
Parameter database Type VARCHAR Required Optional Description Database name, when not encoded in the URI.
Parameter entrypoint Type VARCHAR Required Optional Description Custom driver entrypoint function name (rarely needed).
Parameter extra_options Type MAP(VARCHAR, VARCHAR) Required Optional Description Driver-specific string options. Values are redacted in secret display. Pass numeric or binary options directly as ATTACH options.
Examples
1

Create and use a SQLite secret by name

CREATE SECRET my_sqlite (TYPE adbc, DRIVER 'sqlite', URI ':memory:');
ATTACH '' AS db (TYPE adbc, secret 'my_sqlite');
SELECT * FROM adbc_scan('db', 'SELECT 1 AS id', columns := {'id': 'BIGINT'});
DETACH db;
DROP SECRET my_sqlite;
2

Omit SCOPE: the secret's URI becomes its scope, so ATTACH finds it from the path

CREATE SECRET app_db (TYPE adbc, DRIVER 'sqlite', URI 'app.sqlite');
ATTACH 'app.sqlite' AS app (TYPE adbc);
SELECT * FROM adbc_scan('app', 'SELECT 1 AS id', columns := {'id': 'BIGINT'});
DETACH app;
DROP SECRET app_db;

Practical Examples

Cookbook

Real-world recipes and patterns for common use cases.

Platform Support

Compatibility

Extension availability may vary by platform and DuckDB version. Check below to ensure this extension supports your environment before installation.

Quick Facts

Release status Stable
Software License MIT
Pricing Free
Written In C++
Source Available Yes
View on GitHub
Usage
449,011
loads · last 90 days

Platforms

DuckDB 2.0.0

  • Linux x86_64 aarch64
  • Linux (musl) Not available
  • macOS Apple Silicon
  • Windows x86_64 x86_64 (MinGW)
  • WASM Not available
Compiled binary sizes
Platform Architecture Size
Linux x86_64 15.48 MB
Linux aarch64 13.10 MB
macOS Apple Silicon 11.56 MB
Windows x86_64 10.55 MB
Windows x86_64 (MinGW) 18.48 MB

Compressed download sizes for the release shown above.

DuckDB & Haybarn

Release calendar
  • DuckDB v2.0.0 Query.Farm repository Supported
  • Haybarn v1.5.6 Built-in community repository Supported

Browser examples use Haybarn-Wasm 1.5.6.

Checked .

From the blog

Articles

Writing about ADBC Scanner: how it works, what changed, and why.