airflow: Old, unused tags cannot be removed easily
What do you see as an issue?
We recently removed a bunch of our old dags. However, this left behind the tags that used within those DAGs behind. Unfortunately, I cannot find a simple way to clean up the tags besides directly going into the metadatabase and deleting it from there.
The airflow db clean
CLI command also does not help in my case, as it would also remove the DAG itself if run with, for example:
airflow db clean -t dag --clean-beforetimestamp '2023-05-10'
Also, dag_tag is not a valid table selection for this command.
Another strange issue is that the tags are also displayed in a non-alphabetical order. Example:
I could not reproduce this issue with the non-alphabetical list order in a local dev environment at least. Is there a smarter way to clean up the tags and get it to show in a right order?
I am willing to submit a PR if I can get some guidance 😃
Solving the problem
Probably with the introduction of a new table for the clean command such as airflow db clean --tables dag_tag
Anything else
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project’s Code of Conduct
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 16 (15 by maintainers)
Yep, will do. I was hoping the cleanup of non-existent tags would take care of sorting, but no. If someone comes in here with a similar issue: truncating the dag_tag table is okay, the tags get resynced.
Solving this may require an extra table, an association table…I will take a look