Accepted SQL
Thunderduck runs DuckDB’s dialect. Every statement is classified before the engine sees it, and a refusal is structured — read it rather than retrying variations.
Always allowed
SELECT, plus DESCRIBE, SHOW TABLES and read-only pragmas, which the parser
treats as selects.
Allowed when the caller can write
INSERT, UPDATE, DELETE, CREATE, DROP, ALTER — subject to the catalog
being writable and, for API and AI callers, the token carrying a write scope.
COPY is allowed in exactly one form, which writes query results as a file into
your own object-storage catalog (the same write rules apply):
COPY (SELECT * FROM sales) TO 'raw_files/exports/sales.csv' (HEADER);See Exporting files. COPY … FROM, COPY <table> TO
without a query, and any target that is not a catalog path are refused.
Never allowed
ATTACH, COPY (other than the export form above), non-read PRAGMA, SET, INSTALL/LOAD, CALL, EXPORT,
VACUUM, CREATE SECRET, ATTACH … (TYPE lance), Lance blob and maintenance functions, explicit transactions, and the query() and
getenv() functions. These reconfigure the engine rather than
touching data; permission to change data is not permission to reconfigure the
engine that runs it.
EXPLAIN
EXPLAIN <stmt> is unwrapped and the inner statement judged by these same rules,
because EXPLAIN ANALYZE <stmt> genuinely executes the statement. For a plan
without execution, use the cost estimate instead.
Reading files
read_csv, read_parquet, read_json, read_xlsx and friends accept a
catalog/path first argument, which is rewritten to the catalog’s bucket with its
own credentials.
Local filesystem paths and arbitrary URLs are rejected — in a subquery or a
CREATE TABLE … AS SELECT just as in a bare SELECT. A path must start with
one of your catalog names; anything else is refused, as are computed paths
('raw/' || name). Reference a catalog rather
than a path, and if the data lives in object storage, register it as a catalog
once instead of pasting a URL into every query.
Iceberg
Five Iceberg read functions are allowed: iceberg_scan, iceberg_metadata,
iceberg_snapshots, iceberg_column_stats and iceberg_partition_stats.
- Each takes the table’s path as a string literal, under the same catalog rule as any other read: it must start with one of your catalog names, and the path is rewritten to that catalog’s bucket with its own credentials.
- The catalog-qualified form
iceberg_snapshots(my_catalog.default.t)is a table reference, not a path literal, and is refused. Use the table’s storage path. - The engine loads the Iceberg extension itself when your SQL names one of
these functions, so there is no
INSTALL/LOADstep — and those statements remain refused anyway.
The functions that write Iceberg state are refused whatever the scope:
iceberg_load_table_response (it exposes storage credentials), the
iceberg_table_properties / iceberg_schema_properties readers and their
set_ / remove_ mutators, and iceberg_to_ducklake, which copies a table to
another catalog. To change a table, write normal SQL against it; maintenance is
LakeOps’s job, not a query’s.
Lance datasets
A table string ending in .lance, such as FROM 'catalog/path/data.lance',
reads a Lance dataset, and lance_vector_search, lance_fts and
lance_hybrid_search search one; the dataset must be a string literal. Lance
blob and maintenance functions and ATTACH … (TYPE lance) are never allowed.
See Lance datasets.
Path and function rules
- A read path must start with a catalog name.
- No
?or#in paths, so DuckDB’s?single-character glob is not available; use*or[...]. No..segments either. - No line may start with
.; write0.5, not.5. - Table functions are an allowlist:
read_csv,read_csv_auto,read_parquet,parquet_scan,read_json,read_json_auto,read_ndjson,read_ndjson_auto,read_text,read_xlsx,glob, the five Iceberg readers above,parquet_metadata/parquet_schema/parquet_file_metadata/parquet_kv_metadata/parquet_bloom_probe,clickhouse_query,range,generate_series,unnest,repeat,histogram, and the metadata functionsduckdb_tables,duckdb_columns,duckdb_views,duckdb_schemas,duckdb_databases,duckdb_types,duckdb_constraints,duckdb_indexes,duckdb_functionsandduckdb_keywords.duckdb_secrets,duckdb_settingsandduckdb_extensionsare not available. - Passthrough functions such as
postgres_queryandbigquery_querycannot be called directly; pushdown to those engines is automatic. Each pushed-down statement carries a-- Thunderduck Query.comment with the run and user id; see Query attribution. - S3, GCS and Azure catalogs without their own credentials cannot be read.
- ClickHouse catalogs must use a public DNS hostname, not an IP address or an internal name.
Syntax vs binding
A syntax error fails immediately, in the response. A binding error — unknown table, unknown column — arrives a moment later as a failed query, because resolving names requires your catalog credentials, and those are only opened where the query actually runs.