- 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
- Overview
- Writing to Iceberg
- Iceberg REST Catalogs
- Functions and Settings Reference
- Amazon S3 Tables
- Amazon SageMaker Lakehouse (AWS Glue)
- Troubleshooting
- ICU
- inet
- jemalloc
- Lance
- 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
- 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
The iceberg extension supports writing to Iceberg tables that are managed by an Iceberg REST Catalog. All write operations go through the attached catalog and are committed as new Iceberg snapshots.
Writing requires an attached catalog. The path-based
iceberg_scaninterface described in the overview is read-only. To write, first attach an Iceberg REST catalog.
The examples below assume a catalog has been attached as my_catalog.
Creating Schemas and Tables
Iceberg namespaces are exposed as schemas. You can create and drop schemas and tables with standard SQL:
CREATE SCHEMA my_catalog.sales;
USE my_catalog.sales;
CREATE TABLE my_catalog.sales.events (
id INTEGER,
event_name VARCHAR,
event_time TIMESTAMP
);
-- Create a table from a query
CREATE TABLE my_catalog.sales.events_copy AS
FROM my_catalog.sales.events;
DROP TABLE my_catalog.sales.events_copy;
Partitioning
Tables can be partitioned with the PARTITIONED BY clause using the Iceberg partition transforms:
| Transform | Description |
|---|---|
column |
Identity – partition by the column value directly. |
year(column), month(column), day(column), hour(column) |
Partition by a date/timestamp component. |
bucket(n, column) |
Hash the column into n buckets. |
truncate(n, column) |
Truncate the column value to width n. |
CREATE TABLE my_catalog.sales.events (
id INTEGER,
event_name VARCHAR,
event_time TIMESTAMP
)
PARTITIONED BY (day(event_time), bucket(16, id));
The partition spec can be changed on an existing table with ALTER TABLE ... SET PARTITIONED BY:
ALTER TABLE my_catalog.sales.events SET PARTITIONED BY (month(event_time));
The
write.target-file-size-bytesandwrite.parquet.row-group-size-bytestable properties are not honored for partitioned tables and raise an error. Setignore_target_file_size_for_partitioned_tablesorignore_row_group_size_for_partitioned_tablestotrueto ignore them instead.
Table Properties
Iceberg table properties can be set at creation time with a WITH clause. The format-version and location keys are recognized specially; any other key-value pairs are stored as table properties:
CREATE TABLE my_catalog.sales.events (a INTEGER)
WITH (
'format-version' = '2', -- Iceberg format version (2 or 3)
'location' = 's3://my-bucket/events', -- base location for the table's data
'my.custom.property' = 'value'
);
Existing properties can be inspected and modified with the property functions:
-- View properties
SELECT * FROM iceberg_table_properties(my_catalog.sales.events);
-- Set properties
CALL set_iceberg_table_properties(
my_catalog.sales.events,
MAP {'write.update.mode': 'merge-on-read', 'write.delete.mode': 'merge-on-read'}
);
-- Remove properties
CALL remove_iceberg_table_properties(my_catalog.sales.events, ['my.custom.property']);
See the Functions and Settings Reference for the equivalent schema (namespace) property functions.
Inserting Data
INSERT INTO my_catalog.sales.events
VALUES (1, 'click', TIMESTAMP '2026-06-01 10:00:00');
-- Insert the result of a query
INSERT INTO my_catalog.sales.events
SELECT * FROM source_table;
-- Match columns by name rather than position
INSERT INTO my_catalog.sales.events BY NAME
SELECT event_time, id, event_name FROM source_table;
Updating and Deleting
UPDATE my_catalog.sales.events SET event_name = 'view' WHERE id = 1;
DELETE FROM my_catalog.sales.events WHERE event_time < TIMESTAMP '2026-01-01';
UPDATE and DELETE are supported on both partitioned and unpartitioned tables. They use merge-on-read semantics and write positional delete files; see Limitations.
Merging Data
MERGE INTO performs an upsert against a source relation. The join key is given with a second USING clause (see the MERGE INTO statement):
MERGE INTO my_catalog.sales.events AS target
USING new_events AS source USING (id)
WHEN MATCHED THEN UPDATE SET event_name = source.event_name
WHEN NOT MATCHED THEN INSERT VALUES (source.id, source.event_name, source.event_time);
Evolving the Schema
The following ALTER TABLE operations are supported:
ALTER TABLE my_catalog.sales.events ADD COLUMN source VARCHAR DEFAULT 'web';
ALTER TABLE my_catalog.sales.events DROP COLUMN source;
ALTER TABLE my_catalog.sales.events RENAME COLUMN id TO event_id;
ALTER TABLE my_catalog.sales.events ALTER COLUMN event_id TYPE BIGINT;
ALTER TABLE my_catalog.sales.events RENAME TO event_log;
ALTER TABLE my_catalog.sales.events ALTER COLUMN event_id SET DEFAULT 0;
ALTER TABLE my_catalog.sales.events ALTER COLUMN event_id DROP DEFAULT;
Copying Between DuckDB and Iceberg
Because the full DDL and DML set is supported, COPY FROM DATABASE can perform deep copies between Iceberg and DuckDB storage in either direction:
COPY FROM DATABASE duckdb_db TO my_catalog;
COPY FROM DATABASE my_catalog TO duckdb_db;
To copy an Iceberg catalog into DuckLake, see Interoperability with DuckLake.
Limitations
UPDATEandDELETEwrite positional deletes only; copy-on-write is not supported.UPDATEandDELETEonly support merge-on-read semantics. If a table setswrite.update.modeorwrite.delete.modeto anything other thanmerge-on-read, the operation fails.- The
write.target-file-size-bytesandwrite.parquet.row-group-size-bytestable properties are not honored for partitioned tables (see Partitioning).