Skip to content

Mutation functions in the ADBC Scanner DuckDB extension

Function category

Mutation

2 functions

adbc_execute

Table function Mutation
Signature
adbc_execute(database: VARCHAR, query: VARCHAR) → TABLE
Arguments (Positional)
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 rows_affected Type BIGINT Description Affected row count, or NULL when unknown.
Description
1 SQLite example
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;

adbc_insert

Table function Mutation
Signature
adbc_insert( database: VARCHAR, table_name: VARCHAR, data: TABLE, max_batches := BIGINT, mode := VARCHAR, options := ANY ) → TABLE
Arguments
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
1 SQLite example
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;