- Installation
- Documentation
- Getting Started
- Connect
- Data Import and Export
- Overview
- Data Sources
- CSV Files
- JSON Files
- Overview
- Creating JSON
- Loading JSON
- Writing JSON
- JSON Type
- JSON Functions
- Format Settings
- Installing and Loading
- SQL to / from JSON
- Caveats
- Multiple Files
- Parquet Files
- Partitioning
- Appender
- INSERT Statements
- Lakehouse Formats
- Client APIs
- Overview
- ADBC
- C
- Overview
- Startup
- Configuration
- Query
- Data Chunks
- Vectors
- Values
- Types
- Prepared Statements
- Appender
- Table Functions
- Replacement Scans
- API Reference
- C++
- CLI
- Overview
- Arguments
- Dot Commands
- Output Formats
- Editing
- Friendly CLI
- Safe Mode
- Autocomplete
- Syntax Highlighting
- Known Issues
- Go
- Java (JDBC)
- Node.js (Neo)
- ODBC
- Python
- Overview
- Data Ingestion
- Conversion between DuckDB and Python
- DB API
- Relational API
- Function API
- Types API
- Expression API
- Spark API
- API Reference
- Known Python Issues
- R
- Rust
- Wasm
- Tertiary Clients
- SQL
- Introduction
- Statements
- Overview
- ANALYZE
- ALTER TABLE
- ALTER VIEW
- ATTACH and DETACH
- CALL
- CHECKPOINT
- COMMENT ON
- COPY
- CREATE INDEX
- CREATE MACRO
- CREATE SCHEMA
- CREATE SECRET
- CREATE SEQUENCE
- CREATE TABLE
- CREATE VIEW
- CREATE TYPE
- DELETE
- DESCRIBE
- DROP
- EXPORT and IMPORT DATABASE
- INSERT
- LOAD / INSTALL
- MERGE INTO
- PIVOT
- Profiling
- SELECT
- SET / RESET
- SET VARIABLE
- SHOW and SHOW DATABASES
- SUMMARIZE
- Transaction Management
- UNPIVOT
- UPDATE
- USE
- VACUUM
- Query Syntax
- SELECT
- FROM and JOIN
- WHERE
- GROUP BY
- GROUPING SETS
- HAVING
- ORDER BY
- LIMIT and OFFSET
- SAMPLE
- Unnesting
- WITH
- WINDOW
- QUALIFY
- VALUES
- FILTER
- Set Operations
- Prepared Statements
- Data Types
- Overview
- Array
- Bitstring
- Blob
- Boolean
- Date
- Enum
- Geometry
- Interval
- List
- Literal Types
- Map
- NULL Values
- Numeric
- Struct
- Text
- Time
- Timestamp
- Time Zones
- Union
- Typecasting
- Variant
- Expressions
- Overview
- CASE Expression
- Casting
- Collations
- Comparisons
- IN Operator
- Logical Operators
- Star Expression
- Subqueries
- TRY
- Functions
- Overview
- Aggregate Functions
- Array Functions
- Bitstring Functions
- Blob Functions
- Date Format Functions
- Date Functions
- Date Part Functions
- Enum Functions
- Geometry Functions
- Interval Functions
- Lambda Functions
- List Functions
- Map Functions
- Nested Functions
- Numeric Functions
- Pattern Matching
- Regular Expressions
- Struct Functions
- Text Functions
- Time Functions
- Timestamp Functions
- Timestamp with Time Zone Functions
- Union Functions
- Utility Functions
- Window Functions
- Constraints
- Indexes
- Meta Queries
- DuckDB's SQL Dialect
- Overview
- Indexing
- Friendly SQL
- Keywords and Identifiers
- Order Preservation
- PostgreSQL Compatibility
- SQL Quirks
- PEG Parser
- Samples
- Configuration
- Extensions
- Overview
- Installing Extensions
- Advanced Installation Methods
- Distributing Extensions
- Versioning of Extensions
- Troubleshooting of Extensions
- Core Extensions
- Overview
- AutoComplete
- Avro
- AWS
- Azure
- Delta
- DuckLake
- Encodings
- Excel
- Full Text Search
- httpfs (HTTP and S3)
- Iceberg
- ICU
- inet
- jemalloc
- Lance
- MotherDuck
- MySQL
- ODBC
- Quack
- PostgreSQL
- Spatial
- SQLite
- TPC-DS
- TPC-H
- UI
- Unity Catalog
- Vortex
- VSS
- Quack Remote Protocol
- Guides
- Overview
- Data Viewers
- Database Integration
- File Formats
- Overview
- CSV Import
- CSV Export
- Directly Reading Files
- Directly Reading DuckDB Databases
- Excel Import
- Excel Export
- JSON Import
- JSON Export
- Parquet Import
- Parquet Export
- Querying Parquet Files
- File Access with the file: Protocol
- Meta Queries
- Describe Table
- EXPLAIN: Inspect Query Plans
- EXPLAIN ANALYZE: Profile Queries
- List Tables
- Summarize
- DuckDB Environment
- Network and Cloud Storage
- Overview
- HTTP Parquet Import
- S3 Parquet Import
- S3 Parquet Export
- S3 Iceberg Import
- S3 Express One
- GCS Import
- Cloudflare R2 Import
- DuckDB over HTTPS / S3
- Fastly Object Storage Import
- Tigris Import
- ODBC
- Performance
- Overview
- Environment
- Import
- Schema
- Indexing
- Join Operations
- File Formats
- How to Tune Workloads
- My Workload Is Slow
- Out-of-Memory Issues
- Benchmarks
- Working with Huge Databases
- Python
- Installation
- Executing SQL
- Jupyter Notebooks
- marimo Notebooks
- SQL on Pandas
- Import from Pandas
- Export to Pandas
- Import from Numpy
- Export to Numpy
- SQL on Arrow
- Import from Arrow
- Export to Arrow
- Relational API on Pandas
- Multiple Python Threads
- Integration with Ibis
- Integration with Polars
- Integration with PyTorch
- Using fsspec Filesystems
- SQL Editors
- SQL Features
- AsOf Join
- Full-Text Search
- Graph Queries
- query and query_table Functions
- Merge Statement for SCD Type 2
- Timestamp Issues
- Snippets
- Creating Synthetic Data
- Dutch Railway Datasets
- Sharing Macros
- Analyzing a Git Repository
- Importing Duckbox Tables
- Copying an In-Memory Database to a File
- Troubleshooting
- Glossary of Terms
- Browsing Offline
- Operations Manual
- Overview
- DuckDB's Footprint
- Installing DuckDB
- Logging
- User Agents
- Securing DuckDB
- Non-Deterministic Behavior
- Limits
- DuckDB Docker Container
- Development
- DuckDB Repositories
- Release Cycle
- Metrics
- Profiling
- Building DuckDB
- Overview
- Build Configuration
- Building Extensions
- Android
- Linux
- macOS
- Raspberry Pi
- Windows
- Python
- R
- Troubleshooting
- Unofficial and Unsupported Platforms
- Benchmark Suite
- Testing
- Internals
- Sitemap
- Live Demo
This page lists the options of the iceberg extension: the parameters accepted by the Iceberg functions, the options of the ATTACH and CREATE SECRET statements used to connect to a catalog, and the global settings.
Scan Options
The following parameters can be passed to iceberg_scan and iceberg_metadata:
| Parameter | Type | Default | Description |
|---|---|---|---|
allow_moved_paths |
BOOLEAN |
false |
Allows scanning Iceberg tables that are moved |
metadata_compression_codec |
VARCHAR |
'' |
Treats metadata files as when set to 'gzip' |
snapshot_from_id |
UBIGINT |
NULL |
Access snapshot with a specific id |
snapshot_from_timestamp |
TIMESTAMP |
NULL |
Access snapshot with a specific timestamp |
version |
VARCHAR |
'?' |
Provides an explicit version string, hint file or guessing |
version_name_format |
VARCHAR |
'v%s%s.metadata.json,%s%s.metadata.json' |
Controls how versions are converted to metadata file names |
iceberg_snapshotsdoes not takeallow_moved_paths,snapshot_from_idorsnapshot_from_timestampas parameters.
ATTACH Options
A REST Catalog with OAuth2 authorization can be attached with just an ATTACH statement. See the complete list of ATTACH options for a REST Catalog below.
| Parameter | Type | Default | Description |
|---|---|---|---|
ENDPOINT_TYPE |
VARCHAR |
NULL |
Used for attaching S3 Tables or Glue catalogs. Allowed values are GLUE and S3_TABLES. Cannot be combined with ENDPOINT or AUTHORIZATION_TYPE. |
ENDPOINT |
VARCHAR |
NULL |
URL endpoint to communicate with the REST Catalog. Cannot be used in conjunction with ENDPOINT_TYPE. |
SECRET |
VARCHAR |
NULL |
Name of the secret used to communicate with the REST Catalog. |
CLIENT_ID |
VARCHAR |
NULL |
CLIENT_ID used for the secret. |
CLIENT_SECRET |
VARCHAR |
NULL |
CLIENT_SECRET used for the secret. |
DEFAULT_REGION |
VARCHAR |
NULL |
Default region to use when communicating with the storage layer. |
DEFAULT_SCHEMA |
VARCHAR |
NULL |
The default schema (namespace) to use for the attached catalog. |
OAUTH2_SERVER_URI |
VARCHAR |
NULL |
OAuth2 server URL for getting a Bearer token. |
AUTHORIZATION_TYPE |
VARCHAR |
OAUTH2 |
Authorization scheme. Pass SigV4 for catalogs that require SigV4 authorization, or none for catalogs that need no authentication. Cannot be combined with ENDPOINT_TYPE. |
ACCESS_DELEGATION_MODE |
VARCHAR |
vended_credentials |
Access delegation mode. Allowed values are vended_credentials and none. |
EXTRA_HTTP_HEADERS |
MAP |
NULL |
Additional HTTP headers to send with REST Catalog requests. |
SUPPORT_NESTED_NAMESPACES |
BOOLEAN |
false |
Set to true for catalogs that support nested namespaces. |
STAGE_CREATE_TABLES |
BOOLEAN |
true |
Controls whether DuckDB uses staged CREATE TABLE. Disable for catalogs that do not support staged table creation. |
DISABLE_MULTI_TABLE_COMMIT |
BOOLEAN |
false |
Disables the multi-table transactions/commit endpoint. Enable for catalogs that reject this endpoint. |
SKIP_CREATE_TABLE_METADATA_UPDATES |
BOOLEAN |
false |
Skips follow-up metadata updates after non-staged CREATE TABLE. Enable for catalogs that fully initialize metadata during table creation and reject subsequent updates. |
REMOVE_FILES_ON_DELETE |
BOOLEAN |
true |
Controls whether DuckDB removes storage files when a table is dropped. |
PURGE_REQUESTED |
BOOLEAN |
false |
Sends the PurgeRequested parameter when dropping a table. |
ENCODE_ENTIRE_PREFIX |
BOOLEAN |
false |
URL-encode the entire path prefix when communicating with the catalog. |
MAX_TABLE_STALENESS |
INTERVAL |
NULL |
Prevents unnecessary requests to the Iceberg REST Catalog. Accepts human-readable interval strings such as 10 minutes, 30 seconds, or 1 year. |
When attaching an AWS catalog with
ENDPOINT_TYPE(s3_tablesorglue), DuckDB applies AWS-appropriate defaults:stage_create_tablesandremove_files_on_deletebecomefalseandpurge_requestedbecomestrue, unless you set them explicitly.
Working with an Attached Catalog
Once a catalog is attached, you can run the full set of read and write operations against its tables:
- Reading and metadata:
SELECT, time travel with theATclause, and theiceberg_metadata,iceberg_snapshots, and statistics functions. See the Functions and Settings Reference. - Writing:
CREATE/DROP SCHEMAandTABLE, partitioning,INSERT,UPDATE,DELETE,MERGE INTO,ALTER TABLE, table properties, andCOPY FROM DATABASE. See Writing to Iceberg.
Metadata functions accept a fully qualified table name, e.g.:
SELECT * FROM iceberg_snapshots(my_catalog.default.t);
Secret Options
The following options can only be passed to a CREATE SECRET statement and they require AUTHORIZATION_TYPE to be OAUTH2:
| Parameter | Type | Default | Description |
|---|---|---|---|
OAUTH2_GRANT_TYPE |
VARCHAR |
NULL |
Grant Type when requesting an OAuth Token. |
OAUTH2_SCOPE |
VARCHAR |
NULL |
Requested scope for the returned OAuth Access Token. |
Settings
| Setting | Type | Default | Description |
|---|---|---|---|
unsafe_enable_version_guessing |
BOOLEAN |
false |
Allows the extension to guess the latest metadata version when no version or hint file is given. |
Selecting Metadata Versions
By default, the iceberg extension will look for a version-hint.text file to identify the proper metadata version to use. This can be overridden by explicitly supplying a version number via the version parameter to the functions of the iceberg extension:
SELECT *
FROM iceberg_snapshots(
'data/iceberg/lineitem_iceberg',
version = '1'
);
By default, iceberg functions will look for both v{version}.metadata.json and {version}.metadata.json files, or v{version}.gz.metadata.json and {version}.gz.metadata.json when metadata_compression_codec = 'gzip' is specified.
Other compression codecs are not supported.
If any text file is provided through the version parameter, it is opened and treated as a version hint file:
SELECT *
FROM iceberg_snapshots(
'data/iceberg/lineitem_iceberg',
version = 'version-hint.txt'
);
The iceberg extension will open this file and use the entire content of the file as a provided version number.
Note that the entire content of the version-hint.txt file will be treated as a literal version name, with no encoding, escaping or trimming. This includes any whitespace, or unsafe characters which will be explicitly passed formatted into filenames in the logic described below.
Working with Alternative Metadata Naming Conventions
The iceberg extension can handle different metadata naming conventions by specifying them as a comma-delimited list of format strings via the version_name_format parameter. Each format string must contain two %s parameters. The first is the location of the version number in the metadata filename and the second is the location of the filename extension specified by the metadata_compression_codec. The behavior described above is provided by the default value of "v%s%s.metadata.gz,%s%smetadata.gz.
If you had an alternatively named metadata file, e.g., rev-2.metadata.json.gz, the table can be read via the follow statement:
SELECT *
FROM iceberg_snapshots(
'data/iceberg/alternative_metadata_gz_naming',
version = '2',
version_name_format = 'rev-%s.metadata.json%s',
metadata_compression_codec = 'gzip'
);
“Guessing” Metadata Versions
By default, either a table version number or a version-hint.text must be provided for the iceberg extension to read a table. This is typically provided by an external data catalog. In the event neither is present, the iceberg extension can attempt to guess the latest version by passing ? as the version parameter:
SELECT count(*)
FROM iceberg_scan(
'data/iceberg/lineitem_iceberg_no_hint',
version = '?',
allow_moved_paths = true
);
The “latest” version is assumed to be the filename that is lexicographically largest when sorting the filenames. Collations are not considered. This behavior is not enabled by default as it may potentially violate ACID constraints. It can be enabled by setting unsafe_enable_version_guessing to true. When this is set, iceberg functions will attempt to guess the latest version by default before failing.
SET unsafe_enable_version_guessing = true;
SELECT count(*)
FROM iceberg_scan(
'data/iceberg/lineitem_iceberg_no_hint',
allow_moved_paths = true
);