Mutation functions in the ADBC Scanner DuckDB extension
Function category
Mutation
2 functionsExecute remote DDL/DML with CALL adbc_execute, or ingest Arrow batches with adbc_insert. Both join an open BEGIN … COMMIT transaction.
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
database
|
Type
VARCHAR
|
Mode Positional | Description Alias of an ATTACH … (TYPE adbc) database. Unknown or non-ADBC names fail at bind. |
Argument
query
|
Type
VARCHAR
|
Mode Positional | Description |
Returns
A table with the following columns:
| Column | Type | Description |
|---|---|---|
Column
rows_affected
|
Type
BIGINT
|
Description Affected row count, or NULL when unknown. |
Description
Use standalone CALL to execute remote DDL or DML at runtime on an attached ADBC database. Inside BEGIN … COMMIT it joins the attachment's transaction; otherwise it autocommits on the attachment's own connection, so session state such as temp tables and SET carries across calls. Returns one rows_affected BIGINT row, or NULL when unknown. PREPARE and ordinary EXPLAIN do not execute the command; EXPLAIN ANALYZE does. Rejected on a READ_ONLY attachment.
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'')');
DETACH db;
Signature
Arguments
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
database
|
Type
VARCHAR
|
Mode Positional | Description Alias of an ATTACH … (TYPE adbc) database. Unknown or non-ADBC names fail at bind. |
Argument
table_name
|
Type
VARCHAR
|
Mode Positional | Description |
Argument
data
|
Type
TABLE
|
Mode Positional | Description |
Argument
mode
|
Type
VARCHAR
|
Mode Named | Description Ingestion mode: 'create', 'append', 'replace', or 'create_append'. |
Argument
max_batches
|
Type
BIGINT
|
Mode Named | Description Maximum Arrow batches queued between the DuckDB producer and the ingest consumer. |
Argument
options
|
Type
ANY
|
Mode Named | Description Driver-specific statement options as a STRUCT or MAP, e.g. {'adbc.ingest.temporary': 'true'}. Applied after the target table and mode; keys adbc_insert sets itself are rejected. |
Description
Pass a DuckDB query's Arrow batches to the driver's bulk ingestion API. Modes: create, append, replace, create_append. Inside BEGIN … COMMIT it joins the attachment's transaction. Rejected on a READ_ONLY attachment. Stream binding and execution run together on a consumer thread, so drivers that read their input during BindStream ingest without blocking.
ATTACH ':memory:' AS db (TYPE adbc, driver 'sqlite');
SELECT * FROM adbc_insert('db', 'users', (SELECT 1::BIGINT AS id, 'Alice' AS name), mode := 'create');
DETACH db;