1fanwang commented on issue #66786:
URL: https://github.com/apache/airflow/issues/66786#issuecomment-4438628034

   Concrete trace for each dialect, captured via the regression test in #66788 
with the new `except IntegrityError` arm removed (i.e. current `main` 
behaviour). Each `_serialize_dag_capturing_errors` call routes the 
unique-constraint failure through the generic `except Exception` arm and writes 
the SQLAlchemy traceback into `import_errors`:
   
   ```
   sqlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) UNIQUE constraint 
failed: serialized_dag.dag_id
   [SQL: INSERT INTO serialized_dag ...]
   
   sqlalchemy.exc.IntegrityError: (MySQLdb.IntegrityError) (1062, "Duplicate 
entry 'my_dag' for key 'serialized_dag.PRIMARY'")
   [SQL: INSERT INTO serialized_dag ...]
   
   sqlalchemy.exc.IntegrityError: (psycopg2.errors.UniqueViolation) duplicate 
key value violates unique constraint "serialized_dag_pkey"
   [SQL: INSERT INTO serialized_dag ...]
   ```
   
   That trace is exactly what surfaces in `import_errors` for the rest of the 
parsing cycle. The loser's transaction is left invalid, so subsequent per-Dag 
work in the same `update_dag_parsing_results_in_db` call raises 
`PendingRollbackError`. PR body has the parametrized before-and-after pytest 
snippet showing the three dialects flip from FAILED to PASSED.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to