Skip to content

Support schema-qualified table names in db clean#70147

Open
seanmuth wants to merge 2 commits into
apache:mainfrom
seanmuth:db-cleanup-schema-qualified-tables
Open

Support schema-qualified table names in db clean#70147
seanmuth wants to merge 2 commits into
apache:mainfrom
seanmuth:db-cleanup-schema-qualified-tables

Conversation

@seanmuth

Copy link
Copy Markdown
Contributor

Celery result backends are commonly provisioned into their own database schema, separate from Airflow's metadata tables. airflow db clean has no way to reach celery_taskmeta / celery_tasksetmeta in that case, since it only ever looks in the connection's default schema, so those tables are silently skipped every time.

_TableConfig, reflect_tables, and the archive/export/drop machinery in db_cleanup.py now understand schema-qualified table names ("schema.table" dot notation). A new [celery] result_backend_schema config option lets a deployment point the built-in celery_taskmeta / celery_tasksetmeta configs at the schema they actually live in, without needing a fork or manual per-table config.

Verified end-to-end against a real Postgres instance: clean → archive (lands in the same schema as the source table) → export → drop, all schema-aware. New unit + integration tests cover schema parsing, the config-driven wiring, and the full cleanup cycle; existing test suite passes unmodified on both sqlite and Postgres.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Sonnet 5)

Generated-by: Claude Code (Sonnet 5) following the guidelines

Celery result backends are commonly provisioned into their own database
schema, separate from Airflow's metadata tables. airflow db clean has
no way to reach celery_taskmeta / celery_tasksetmeta in that case, since
it only ever looks in the connection's default schema, so those tables
are silently skipped every time.

_TableConfig, reflect_tables, and the archive/export/drop machinery in
db_cleanup.py now understand schema-qualified table names ("schema.table"
dot notation). A new [celery] result_backend_schema config option lets
a deployment point the built-in celery_taskmeta / celery_tasksetmeta
configs at the schema they actually live in, without needing a fork or
manual per-table config.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant