What happens?
When calling ducklake_flush_inlined_data() from a fresh DuckDB connection (without any prior queries against the table), the resulting Parquet files are written to the table's root directory in S3, ignoring the configured Hive-style partition structure.
The same command executed from a DuckDB CLI session that has previously queried the table correctly respects partitions and writes files to the proper partition paths.
Environment
DuckDB version: 1.4.3
DuckLake version: (latest)
Metadata catalog: PostgreSQL
Data storage: S3
To Reproduce
Table is partitioned using:
ALTER TABLE my_ducklake.main.table
SET PARTITIONED BY (year(_ingest_date), month(_ingest_date), day(_ingest_date));
Scenario A: Working (DuckDB CLI with prior queries)
-- Establish connection and attach catalog
ATTACH 'ducklake:postgres:postgresql://user:pass@host:5432/ducklake_catalog' AS my_ducklake
(DATA_PATH 's3://bucket/data/');
-- Any query that touches the table schema (forces metadata load)
SELECT * FROM my_ducklake.main.table LIMIT 1;
-- OR
DESCRIBE my_ducklake.main.table;
-- Now flush respects partitions ✓
CALL ducklake_flush_inlined_data('my_ducklake');
Result: Files written to s3://bucket/data/year=2025/month=01/day=15/ducklake-xxx.parquet
Scenario B: Not working (Fresh connection, immediate flush)
import duckdb
# Fresh connection
conn = duckdb.connect()
conn.execute("INSTALL ducklake; LOAD ducklake;")
conn.execute("INSTALL postgres; LOAD postgres;")
# Attach catalog
conn.execute("""
ATTACH 'ducklake:postgres:postgresql://user:pass@host:5432/ducklake_catalog' AS my_ducklake
(DATA_PATH 's3://bucket/data/');
""")
# Immediately flush without any prior table access
conn.execute("CALL ducklake_flush_inlined_data('my_ducklake');")
Result: Files written to s3://bucket/data/ducklake-xxx.parquet (root directory, no partitions!)
Workaround
Before calling ducklake_flush_inlined_data, query the partition metadata to force it to be loaded:
-- Force partition metadata load
SELECT * FROM __ducklake_metadata_my_ducklake.public.ducklake_partition_column
WHERE table_id = (
SELECT table_id FROM __ducklake_metadata_my_ducklake.public.ducklake_table
WHERE table_name = 'table' AND end_snapshot IS NULL
);
-- Now flush works correctly
CALL ducklake_flush_inlined_data('my_ducklake');
OS:
aarch64
DuckDB Version:
1.4.3
DuckLake Version:
0.3
DuckDB Client:
Python
Hardware:
AWS Lambda function
Full Name:
Michael Layfer
Affiliation:
CISCO
What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.
I have tested with a stable release
Did you include all relevant data sets for reproducing the issue?
Not applicable - the reproduction does not require a data set
Did you include all code required to reproduce the issue?
Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?
What happens?
When calling ducklake_flush_inlined_data() from a fresh DuckDB connection (without any prior queries against the table), the resulting Parquet files are written to the table's root directory in S3, ignoring the configured Hive-style partition structure.
The same command executed from a DuckDB CLI session that has previously queried the table correctly respects partitions and writes files to the proper partition paths.
Environment
DuckDB version: 1.4.3
DuckLake version: (latest)
Metadata catalog: PostgreSQL
Data storage: S3
To Reproduce
Table is partitioned using:
Scenario A: Working (DuckDB CLI with prior queries)
Result: Files written to s3://bucket/data/year=2025/month=01/day=15/ducklake-xxx.parquet
Scenario B: Not working (Fresh connection, immediate flush)
Result: Files written to s3://bucket/data/ducklake-xxx.parquet (root directory, no partitions!)
Workaround
Before calling ducklake_flush_inlined_data, query the partition metadata to force it to be loaded:
OS:
aarch64
DuckDB Version:
1.4.3
DuckLake Version:
0.3
DuckDB Client:
Python
Hardware:
AWS Lambda function
Full Name:
Michael Layfer
Affiliation:
CISCO
What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.
I have tested with a stable release
Did you include all relevant data sets for reproducing the issue?
Not applicable - the reproduction does not require a data set
Did you include all code required to reproduce the issue?
Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?