Skip to content

feat(adbc_insert): pass driver-specific statement options - #17

Merged
rustyconover merged 1 commit into
Query-farm:mainfrom
jatorre:feat/adbc-insert-options
Sep 22, 2026
Merged

rustyconover merged 1 commit into
Query-farm:mainfrom
jatorre:feat/adbc-insert-options

Conversation

@jatorre

@jatorre jatorre commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

adbc_insert only sets adbc.ingest.target_table and adbc.ingest.mode on the statement, so there's no way to reach ingest options that drivers expose at statement level.

The motivating case is the Snowflake driver: its GeoArrow auto-detect correctly maps planar-edge input (what DuckDB produces) to GEOMETRY, and expects callers who want GEOGRAPHY to say so with adbc.snowflake.statement.ingest_geo_type (see adbc-drivers/snowflake#167). Other drivers have similar statement-level knobs, such as ADBC 1.1's adbc.ingest.temporary, adbc.ingest.target_catalog and adbc.ingest.target_db_schema.

This adds options :=, a STRUCT or MAP with the same shape adbc_connect accepts. It is applied after the target table and mode. Keys adbc_insert already owns (adbc.ingest.target_table, adbc.ingest.mode) are rejected, and unknown keys surface the driver's own error.

SELECT * FROM adbc_insert(conn, 'places', (SELECT * FROM src), mode := 'create',
  options := {'adbc.snowflake.statement.ingest_geo_type': 'geography'});

Tests (test/sql/adbc_insert.test, SQLite driver) use adbc.ingest.temporary to show the option reaches the driver: the table lands in temp, not main. They cover both STRUCT and MAP forms and the three error paths (reserved key, non-STRUCT/MAP value, unknown driver option). The full test/sql/* suite passes locally with HAS_ADBC_SQLITE_DRIVER=1 (834 assertions; the Postgres/MySQL/Trino server tests were skipped).

adbc_insert only set adbc.ingest.target_table and adbc.ingest.mode, so
statement-level ingest options drivers expose were unreachable. Add an
options named parameter (STRUCT or MAP, same shape as adbc_connect) applied
after target table and mode. Keys adbc_insert owns are rejected; unknown
keys surface the driver's error.
@rustyconover

Copy link
Copy Markdown
Contributor

Hi @jatorre looking at this now.

@rustyconover

Copy link
Copy Markdown
Contributor

Looks good to me, I'll merge once CI goes green! Thanks @jatorre

@rustyconover
rustyconover merged commit 2e5235a into Query-farm:main Sep 22, 2026
9 checks passed
@rustyconover

Copy link
Copy Markdown
Contributor

@jatorre waiting for merge into community extensions repo: duckdb/community-extensions#2776

@jatorre

jatorre commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

that was quick! thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants