fix(duckdb): ensure drop_table handles views to avoid catalog errors by Retugbo · Pull Request #5695 · SQLMesh/sqlmesh
Problem: DuckDB maintains a strict distinction between tables and views in its catalog. Invoking DROP TABLE on a view object currently triggers a Catalog Error.
Solution:
This PR introduces a safety check in the drop_table method:
Metadata Inspection: Leverages _get_data_objects to verify the object type at runtime.
Dynamic Routing: If the object is a VIEW, the call is redirected to drop_view.
Signature Integrity: Maintains compatibility with the EngineAdapter superclass while preventing kwargs collisions (specifically the exists flag).
Impact:
Increases the robustness of the DuckDB adapter, preventing workflow interruptions when models are switched between table and view materializations.