Skip to content

DuckDB Extension

ADBC Scanner

Connect DuckDB to databases through Arrow Database Connectivity (ADBC) drivers.

Quick reference PDF 1 page · Printable
398,300
extension loads · last 90 days
On this page

Technical Overview

ADBC drivers, Arrow results, DuckDB SQL

Arrow at the client interface

  • • One API, multiple databases: Use installed ADBC drivers for SQLite, PostgreSQL, Flight SQL, and other supported backends. Available features depend on the driver.
  • • Native libraries: Resolve drivers through installed ADBC manifests or load a shared library by path. Drivers run inside DuckDB with the process's privileges.

Attached databases, one name for everything

  • • Catalog queries: ATTACH with TYPE adbc exposes remote schemas and tables with supported projection/filter pushdown. The catalog pools connections for independent scans; READ_ONLY rejects every write, including adbc_execute and adbc_insert.
  • • Runtime commands and transactions: Use standalone CALL adbc_execute('db', …). Inside BEGIN … COMMIT it commits or rolls back together with INSERT INTO db.… through the catalog. Side effects happen at execution, not during PREPARE or ordinary EXPLAIN.
  • • Schema metadata: adbc_scan uses ExecuteSchema, or an explicit columns declaration when unsupported. adbc_scan_table and adbc_schema obtain named-table metadata through GetTableSchema.

Deep Dive

Technical Details

Install

INSTALL adbc_scanner FROM community;
LOAD adbc_scanner;

Quick Start

Attach a SQLite database

ATTACH ':memory:' AS db (TYPE adbc, driver 'sqlite');
DETACH db;

Query SQLite with an explicit result schema

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

Execute remote DDL and DML with CALL

ATTACH ':memory:' AS db (TYPE adbc, driver 'sqlite');
CALL adbc_execute('db', 'CREATE TABLE users(id INTEGER, name TEXT)');
CALL adbc_execute('db', 'INSERT INTO users VALUES (1, ''Alice'')');
SELECT * FROM adbc_scan_table('db', 'users');
DETACH db;

Commit and roll back with DuckDB transactions

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;

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_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.
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
398,300
loads · last 90 days

Platforms

  • Linux x86_64 aarch64
  • Linux (musl) Not available
  • macOS Intel Apple Silicon
  • Windows x86_64
  • WASM Not available
Compiled binary sizes
Platform Architecture Size
Linux x86_64 11.14 MB
Linux aarch64 9.87 MB
macOS Intel 8.47 MB
macOS Apple Silicon 7.46 MB
Windows x86_64 7.64 MB

Compressed download size from the Haybarn extension repository.

DuckDB & Haybarn

Release calendar