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

Fix airflow db reset when dangling tables exist #25441

Merged
merged 1 commit into from Aug 1, 2022

Conversation

ashb
Copy link
Member

@ashb ashb commented Aug 1, 2022

If one of the "dangling" tables already existed in the DB, performing an airflow db reset would delete the tables, but it would then try and re-create the table later. This was because the Table object was still associated with the Metadata object.

The fix is to remove the it from Metadata once we have dropped it.

If one of the "dangling" tables already existed in the DB, performing an
`airflow db reset` would delete the tables, but it would then try and
_re-create_ the table later. This was because the Table object was still
associated with the Metadata object.

The fix is to remove the it from Metadata once we have dropped it.
@ashb ashb requested a review from ephraimbuddy August 1, 2022 11:16
Copy link
Contributor

@ephraimbuddy ephraimbuddy left a comment

Choose a reason for hiding this comment

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

I think it would be safer to use checkfirst=True?

@ashb
Copy link
Member Author

ashb commented Aug 1, 2022

I think it would be safer to use checkfirst=True?

Two lines up we got the table name from doing inspect.get_table_names() -- we've done the check ourselves already.

@ephraimbuddy ephraimbuddy merged commit 40eefd8 into apache:main Aug 1, 2022
@ephraimbuddy ephraimbuddy deleted the reset-with-moved-tables branch August 1, 2022 12:58
@ephraimbuddy ephraimbuddy added the type:bug-fix Changelog: Bug Fixes label Aug 15, 2022
@ephraimbuddy ephraimbuddy added this to the Airflow 2.3.4 milestone Aug 15, 2022
ephraimbuddy pushed a commit that referenced this pull request Aug 15, 2022
If one of the "dangling" tables already existed in the DB, performing an
`airflow db reset` would delete the tables, but it would then try and
_re-create_ the table later. This was because the Table object was still
associated with the Metadata object.

The fix is to remove the it from Metadata once we have dropped it.

(cherry picked from commit 40eefd8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants