fix(duckdb): ensure drop_table handles views to avoid catalog errors#5695
fix(duckdb): ensure drop_table handles views to avoid catalog errors#5695Retugbo wants to merge 3 commits into
Conversation
|
@Retugbo It looks like some style related test have failed. Could you maybe reformat your change with |
|
@Retugbo I am interested in this fix, but your code does not resolve the issue for me in the case of using the DuckDB engine to write in a Postgres database. (Not sure if that's what you tried to fix) The problem is that the view is already being treated as a table at the level of I drafted another fix for the problem I am having here: #5809 |
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.