Skip to content

Include table names in db clean progress output - #74243

Merged
hussein-awala merged 4 commits into
apache:mainfrom
safaehar:improve-db-clean-table-logging
Nov 4, 2026
Merged

hussein-awala merged 4 commits into
apache:mainfrom
safaehar:improve-db-clean-table-logging

Conversation

@safaehar

@safaehar safaehar commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

airflow db clean can run many batches across multiple metadata tables, but its progress lines do not identify the source table. A line such as Performing Delete (batch 240, max 10000 rows)... is therefore difficult to attribute or filter when reading cleanup logs.

This change makes each per-table cleanup message self-contained:

  • row-count, delete, archive-copy, and completion messages include the source table name;
  • each successful delete reports the number of rows actually deleted;
  • batched delete results include the batch number;
  • singular and plural row labels are handled correctly.

For example:

Performing Delete from xcom (batch 240, max 10000 rows)...
Deleted 5000 rows from xcom (batch 240).
Finished Performing Delete from xcom

Tests

  • uv run --project airflow-core pytest airflow-core/tests/unit/utils/test_db_cleanup.py --with-db-init -xq (SQLite: 100 passed, 3 backend-specific skipped)
  • Focused batched and unbatched progress-output tests (2 passed)
  • prek run --from-ref upstream/main --stage pre-commit
  • prek run --from-ref upstream/main --stage manual --skip compile-ui-assets-dev --skip view-skill-eval --skip run-skill-eval-codex

Was generative AI tooling used to co-author this PR?
  • Yes (Codex)

Generated-by: Codex following the guidelines


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.

@Eason09053360 Eason09053360 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the patch! LGTM Overall
Just one nit feel free to resolve it.

@eladkal eladkal added this to the Airflow 3.4.0 milestone Oct 8, 2026
@eladkal eladkal added the type:misc/internal Changelog: Misc changes that should appear in change log label Oct 8, 2026
@safaehar
safaehar force-pushed the improve-db-clean-table-logging branch from 77be7e6 to 7e0e057 Compare October 8, 2026 12:31
@safaehar
safaehar force-pushed the improve-db-clean-table-logging branch from b4f0e02 to 2a32954 Compare October 29, 2026 13:30
@hussein-awala
hussein-awala merged commit 7badc9f into apache:main Nov 4, 2026
71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:misc/internal Changelog: Misc changes that should appear in change log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants