fix(db_cleanup): remove invalid dag_id column for task_reschedule - #72023
Open
waterWang wants to merge 1 commit into
Open
fix(db_cleanup): remove invalid dag_id column for task_reschedule#72023waterWang wants to merge 1 commit into
waterWang wants to merge 1 commit into
Conversation
TaskReschedule table was migrated in Airflow 3.0 (migration 0063) to use ti_id (FK to task_instance.id) instead of dag_id/task_id/run_id. The dag_id column was dropped. db_cleanup.py still referenced it, causing "column base.dag_id does not exist" errors when running `airflow db clean` with --dag-id filter. Fixes apache#72020
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.
The
TaskRescheduletable was migrated in Airflow 3.0 (migration0063) fromdag_id/task_id/run_idtoti_id(UUID FK totask_instance.id). Thedag_idcolumn was dropped.However,
db_cleanup.py's_TableConfigfortask_reschedulestill specifieddag_id_column_name="dag_id", causing the_build_queryfunction to generate:This fails with
column base.dag_id does not existon PostgreSQL (and similar errors on other databases) whenairflow db cleanis run with a--dag-idfilter.Fix: Remove the
dag_id_column_namefromtask_reschedule's config, since the table no longer has adag_idcolumn and cannot be directly filtered by DAG ID.Other tables without a
dag_idcolumn (e.g.,import_error,callback_request,trigger,celery_taskmeta) already omit this parameter — this fix makestask_rescheduleconsistent with them.Fixes #72020