Alwaysgaurav1 opened a new pull request, #71990:
URL: https://github.com/apache/airflow/pull/71990
### Description
Updates table configurations in `airflow.utils.db_cleanup` to align with
Airflow 3 database schema migrations and fixes test discovery:
1. **`task_reschedule`**:
- In Airflow 3 (migration `0063`), `dag_id`, `task_id`, `run_id`,
`map_index`, and `try_number` were dropped from `task_reschedule` and replaced
with `ti_id` foreign key referencing `task_instance.id`.
- Removed obsolete `dag_id_column_name="dag_id"` which previously
produced SQL errors (`column base.dag_id does not exist`) when running `airflow
db clean --dag-id`.
- Added `"task_reschedule"` to `task_instance.dependent_tables` so that
dependent reschedules are cleaned prior to task instances.
2. **`asset_event`**:
- Corrected `dag_id_column_name` from `"dag_id"` to `"source_dag_id"` to
match the table schema.
3. **`callback` & `sla_miss`**:
- Updated table name from `callback_request` to `callback`.
- Removed obsolete `sla_miss` table (replaced with Deadlines in Airflow
3).
4. **Test Suite Fixes**:
- Fixed `test_no_models_missing` in `test_db_cleanup.py` to dynamically
locate `airflow.models` across monorepo packages.
- Updated exclusion list to accurately account for all 52 Airflow 3
declarative models.
- Added unit tests covering `task_reschedule` (recency and cascade),
`asset_event` DAG ID filtering, and `callback` cleanup.
### Testing
- Ran unit tests: `uv run --project airflow-core pytest
airflow-core/tests/unit/utils/test_db_cleanup.py` (74 passed, 0 failed).
- Formatted and linted with `ruff`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]