fix(duckdb): do not cascade table/view drops in DuckLake catalogs - #6034
Open
kingjaiteh wants to merge 2 commits into
Open
kingjaiteh wants to merge 2 commits into
kingjaiteh wants to merge 2 commits into
Conversation
DuckLake does not implement `DROP TABLE ... CASCADE` or `DROP VIEW ... CASCADE` and raises "Cascade Drop not supported in DuckLake". Since SQLMesh#5133 the janitor always deletes snapshot tables with cascade=True, so on a DuckLake catalog it can never reclaim space and silently reports "Cleanup complete." until a snapshot expires. Cascade support is declared per engine adapter, but on DuckDB it varies per attached catalog. Resolve the target catalog's type from duckdb_databases() and omit CASCADE for TABLE/VIEW drops in DuckLake catalogs. SCHEMA cascade is still supported by DuckLake and is left untouched, as is behaviour for native DuckDB catalogs. Fixes SQLMesh#6032 Signed-off-by: kingjaiteh <omarjaiteh453@gmail.com>
StuffbyYuki
force-pushed
the
fix/6032-ducklake-drop-cascade
branch
from
October 2, 2026 07:14
8f4e72b to
9d3a6fb
Compare
Collaborator
|
@kingjaiteh Thanks for the PR! No blocker but a few things:
|
Author
|
Thanks @StuffbyYuki! Both done: |
Catalog aliases keep their case in duckdb_databases() (e.g. MyLake), but SQLMesh lowercases table names, so the DuckLake lookup missed and CASCADE was emitted again. Signed-off-by: kingjaiteh <omarjaiteh453@gmail.com>
kingjaiteh
force-pushed
the
fix/6032-ducklake-drop-cascade
branch
from
October 3, 2026 15:01
96d44e2 to
938ef89
Compare
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.
Fixes #6032
DuckLake does not implement
DROP TABLE ... CASCADEorDROP VIEW ... CASCADEand raises "Cascade Drop not supported in DuckLake". Since #5133 the janitor always deletes snapshot tables with cascade=True, so on a DuckLake catalog it can never reclaim space and silently reports "Cleanup complete." until a snapshot expires.Cascade support is declared per engine adapter (
SUPPORTED_DROP_CASCADE_OBJECT_KINDS), but on DuckDB it varies per attached catalog: a native catalog acceptsDROP TABLE ... CASCADE, a DuckLake catalog attached in the same connection does not.Changes:
DuckDBEngineAdapter._drop_objectresolves the target catalog (explicit catalog on the name, else the current one) and looks up itstypeinduckdb_databases(). Forducklakeit drops TABLE/VIEW without CASCADE. SCHEMA drops are untouched, DuckLake supports cascade there._get_catalog_type, which_create_tablealready did inline for the DuckLake partitioning check, so both share it.enable_view_dependencieskeep cascade.The list-only alternative (removing TABLE/VIEW from the DuckDB cascade list) would also fix DuckLake but would regress
enable_view_dependencieson native catalogs, which is what #4767 added it for.Test Plan
test_drop_table_ducklake_no_cascadeattaches a real DuckLake catalog (same setup astest_ducklake_partitioning), creates a table with a dependent view in it and a native table/view inmemory, and drops all four withcascade=True. Fails onmainwith theNotImplementedExceptionabove.test_drop_object_cascade_by_catalog_typeasserts the emitted SQL with a mocked adapter: no CASCADE for DuckLake table/view, CASCADE kept for DuckLake schema and for a native catalog table.tests/core/engine_adapter/test_duckdb.pyandtests/core/test_snapshot_evaluator.pypass on DuckDB 1.5.5, Python 3.12, Windows.Checklist
make styleand fixed any issuesmake fast-test)git commit -s) per the DCO