teamclairvoyant/airflow-maintenance-dags

Dependency rule tried to blank-out primary key column 'serialized_dag.dag_id'

Closed this issue · 1 comments

Just completed a fresh Airflow:

  • Airflow: v2.5.1
  • Ubuntu: v22.04
  • MySql: Ver 8.0.32-0ubuntu0.22.04.2 for Linux on x86_64 ((Ubuntu))

I am setting up teamclairvoyant maintenance. airflow-clear-missing-dags.py is failing. It is reporting: "Dependency rule tried to blank-out primary key column 'serialized_dag.dag_id".

How can the maintenance dag be resolved to support Airflow v2.5.1? I reported the issue to airflow. Their response: apache/airflow#29742

I did exactly what the guy said in your linked issue, i replaced this line with this code:

# Add to imports
from airflow.api.common.delete_dag import delete_dag

# replace "session.delete(entry)" with below line
delete_dag(entry.dag_id, keep_records_in_log=False, session=session)

I ran the Clear DAG twice, first time it deleted the DAGs and the second time it showed that they no longer existed. Hope this helps.