yermalov-here commented on code in PR #34418:
URL: https://github.com/apache/airflow/pull/34418#discussion_r1366703285


##########
airflow/models/dag.py:
##########
@@ -3177,11 +3179,11 @@ def bulk_write_to_db(
                 stored_dataset.is_orphaned = expression.false()
                 stored_datasets[stored_dataset.uri] = stored_dataset
             else:
-                session.add(dataset)
-                stored_datasets[dataset.uri] = dataset
-
-        session.flush()  # this is required to ensure each dataset has its PK 
loaded

Review Comment:
   Is it possible that this flush is not only responsible for ensuring the 
dataset PK availability, but for something more and that results into tests 
flakiness?
   Currently I'm moving it together with the `session.add(dataset)` and it is 
only called if new datasets are created.



-- 
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