Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dagster-duckdb] gracefully handle table cleanup exceptions on views #26756

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

OneCyrus
Copy link

Summary & Motivation

we are using an additional type handler for the duckdb io_manager which uses views to link data into the duckdb database to avaoid copying the data. unfrotunately the current io_manager always tries to delete the data in a table even when it's a view. this change ignores exceptions due to views.

How I Tested These Changes

i made this changes locally in our dagster instance and it work's with our custom type handler.

Changelog

dagster-duckdb: gracefully handle table cleanup exceptions on views

@OneCyrus OneCyrus changed the title feat(dagster-duckdb): ignore delete operation exception if it's due to a view feat(dagster-duckdb): gracefully handle table cleanup exceptions on views Dec 30, 2024
@OneCyrus OneCyrus changed the title feat(dagster-duckdb): gracefully handle table cleanup exceptions on views [dagster-duckdb] gracefully handle table cleanup exceptions on views Dec 30, 2024
@jamiedemaria jamiedemaria self-requested a review December 30, 2024 22:00
Copy link
Contributor

@jamiedemaria jamiedemaria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! thanks for contributing. After a test is added, this will be good to go

@@ -262,6 +262,14 @@ def delete_table_slice(context: OutputContext, table_slice: TableSlice, connecti
except duckdb.CatalogException:
# table doesn't exist yet, so ignore the error
pass
except duckdb.BinderException as ex:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding a test for this behavior would be helpful! That way if there are changes in the duckdb package that break this path we'll find out sooner. I think the easiest place for you to put this would be in python_modules/libraries/dagster-duckdb-pandas/dagster_duckdb_pandas_tests/test_type_handler.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants