:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(managed-warehouse): batch DuckLake file registration (#77747)
Eric Duong6e428da308f5
diff --git a/products/managed_warehouse/backend/temporal/ducklake_register_data_imports_workflow.py b/products/managed_warehouse/backend/temporal/ducklake_register_data_imports_workflow.pyindex d71a2a689d3c..369090c25163 100644--- a/products/managed_warehouse/backend/temporal/ducklake_register_data_imports_workflow.py+++ b/products/managed_warehouse/backend/temporal/ducklake_register_data_imports_workflow.py@@ -528,18 +528,17 @@ def _register_prepared_parquet_files(psql.SQL(", ").join(psql.Identifier(column) for column in partition_columns),))- for landing_path in landing_paths:- conn.execute(- psql.SQL(- "CALL ducklake_add_data_files({}, {}, {}, schema => {}, "- "allow_missing => true, hive_partitioning => true)"- ).format(- psql.Literal("ducklake"),- psql.Literal(shadow_name),- psql.Literal(landing_path),- psql.Literal(schema_name),- )+ conn.execute(+ psql.SQL(+ "CALL ducklake_add_data_files({}, {}, {}, schema => {}, "+ "allow_missing => true, hive_partitioning => true)"+ ).format(+ psql.Literal("ducklake"),+ psql.Literal(shadow_name),+ parquet_paths,+ psql.Literal(schema_name),)+ )with _stage_timer(stage="verify", team_id=inputs.team_id, schema_id=inputs.metadata.source_schema_id):source_row = conn.execute(diff --git a/products/managed_warehouse/backend/tests/temporal/test_ducklake_register_data_imports_workflow.py b/products/managed_warehouse/backend/tests/temporal/test_ducklake_register_data_imports_workflow.pyindex 2751d5f6cfca..0ed9060df2a5 100644--- a/products/managed_warehouse/backend/tests/temporal/test_ducklake_register_data_imports_workflow.py+++ b/products/managed_warehouse/backend/tests/temporal/test_ducklake_register_data_imports_workflow.py@@ -222,7 +222,10 @@ def test_copy_activity_uses_s3_copy_and_local_duckgres_postgres_connection(monkeindex for index, query in enumerate(executed) if "DROP TABLE IF EXISTS" in query and "customers" in query)rename_index = next(index for index, query in enumerate(executed) if "RENAME TO" in query)- assert len(registration_indexes) == 2+ assert len(registration_indexes) == 1+ registration_query = executed[registration_indexes[0]]+ assert "_ph_partition_key=2026-07/a.parquet" in registration_query+ assert "_ph_partition_key=2026-08/b.parquet" in registration_queryassert len(verification_indexes) == 2assert max(registration_indexes) < min(verification_indexes)assert max(verification_indexes) < drop_live_index < rename_index