fix: DuckLake DuckDB-backed catalog attach incorrectly applies META_TYPE 'sqlite'#3871
Open
Analect wants to merge 4 commits intodlt-hub:develfrom
Open
fix: DuckLake DuckDB-backed catalog attach incorrectly applies META_TYPE 'sqlite'#3871Analect wants to merge 4 commits intodlt-hub:develfrom
Analect wants to merge 4 commits intodlt-hub:develfrom
Conversation
drivername='duckdb' was handled identically to 'sqlite' in
build_attach_statement, adding META_TYPE 'sqlite' / META_JOURNAL_MODE 'WAL'
parameters that cause DuckDB-format catalog files to fail with:
Failed to execute query "PRAGMA journal_mode=WAL": file is not a database
Split the combined elif branch so drivername='duckdb' generates a clean attach:
ATTACH IF NOT EXISTS 'ducklake:{path}' AS {name} (DATA_PATH '...')
The DuckLakeCredentials docstring explicitly lists duckdb:///catalog.duckdb
as a valid catalog URI, confirming this is a supported use case.
Fixes dlt-hub#3870
Author
|
@burnash ... is there anything I need tweaking to have this considered? Thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
drivername='duckdb' was handled identically to 'sqlite' in build_attach_statement, adding META_TYPE 'sqlite' / META_JOURNAL_MODE 'WAL' parameters that cause DuckDB-format catalog files to fail with:
Failed to execute query "PRAGMA journal_mode=WAL": file is not a databaseSplit the combined elif branch so
drivername='duckdb'generates a clean attach:The
DuckLakeCredentialsdocstring explicitly listsduckdb:///catalog.duckdbas a valid catalog URI, confirming this is a supported use case.Description
Problem
When using a DuckDB-backed DuckLake catalog (
catalog="duckdb:///catalog.duckdb"),pipeline.run()fails with:Root cause
build_attach_statementinsql_client.pyhandled bothdrivername='sqlite'and
drivername='duckdb'in a single branch, always appendingMETA_TYPE 'sqlite', META_JOURNAL_MODE 'WAL', META_BUSY_TIMEOUT 1000.META_TYPE 'sqlite'causes DuckLake to use SQLite operations on the catalogfile. For a DuckDB-format file this hits the SQLite
PRAGMA journal_mode=WALand raises "file is not a database".
Fix
Split the combined
elifinto two separate branches.drivername='duckdb'now generates a clean attach without
META_TYPE:Tests
Added
tests/load/pipeline/test_ducklake_attach.pywith unit tests forbuild_attach_statementcovering both the sqlite and duckdb cases. Testscan be run without external credentials.
Related Issues
Additional Context
Tests pass without external credentials or a live DuckLake instance:
```
pytest tests/load/pipeline/test_ducklake_attach.py -v
tests/load/pipeline/test_ducklake_attach.py::test_sqlite_catalog_includes_meta_type_sqlite PASSED
tests/load/pipeline/test_ducklake_attach.py::test_duckdb_catalog_excludes_meta_type_sqlite PASSED
tests/load/pipeline/test_ducklake_attach.py::test_duckdb_catalog_attach_format PASSED
3 passed in 1.06s
```