sumeetgautam
sumeetgautam

Reputation: 159

In Apache Airflow Tool, DAG wont run due to Duplicate Entry Problem in task_instance table

Today all day i have been getting this error in the scheduler of Airflow.

sqlalchemy.exc.IntegrityError: (_mysql_exceptions.IntegrityError) (1062, "Duplicate entry '%' fir key 'PRIMARY')")

Because of this the Airflow Scheduler would stop and every time i ran this had the same problem

Upvotes: 1

Views: 3222

Answers (1)

sumeetgautam
sumeetgautam

Reputation: 159

This is due to MySQL's ON UPDATE CURRENT_TIMESTAMP and this is posted in JIRA of Airflow :

https://issues.apache.org/jira/projects/AIRFLOW/issues/AIRFLOW-3045?filter=allopenissues

I fixed this by altering the table to

alter table `task_instance` change `execution_date` `execution_date` TIMESTAMP(6) not null DEFAULT CURRENT_TIMESTAMP(6);

Upvotes: 3

Related Questions