Apache Iceberg
MotherDuck supports querying data in the Apache Iceberg format. The Iceberg DuckDB extension is loaded automatically when any of the supported Iceberg functions are called.
Iceberg functions
Function Name | Description |
---|---|
iceberg_scan | Query Iceberg data |
iceberg_metadata | Query Iceberg metadata, such as the snapshot status, data format, and number of records. |
iceberg_snapshots | Information about the snapshots available in the data folder. |
note
The available functions are only for reading Iceberg data. Creating or updating data in Iceberg format is not yet supported.
Examples
-- query data
SELECT count(*)
FROM iceberg_scan('path-to-iceberg-folder',
allow_moved_paths=true);
-- query metadata
SELECT *
FROM iceberg_metadata('path-to-iceberg-folder',
allow_moved_paths=true);
-- query snapshots
SELECT *
FROM iceberg_snapshots('path-to-iceberg-folder');
Query iceberg data stored in Amazon S3
SELECT count(*)
FROM iceberg_scan('s3://<your-bucket>/<your-iceberg-folder>',
allow_moved_paths=true);
note
To query data in a secure Amazon S3 bucket, you will need to configure your Amazon S3 credentials.
Example using MotherDuck Iceberg sample dataset.
SELECT count(*)
FROM iceberg_scan('https://motherduck-demo.s3.amazonaws.com/iceberg/lineitem_iceberg',
allow_moved_paths=true)