uranusjr commented on code in PR #25280:
URL: https://github.com/apache/airflow/pull/25280#discussion_r938427403
##########
airflow/models/dag.py:
##########
@@ -2557,6 +2569,14 @@ def bulk_write_to_db(cls, dags: Collection["DAG"],
session=NEW_SESSION):
orm_dag.tags.append(dag_tag_orm)
session.add(dag_tag_orm)
+ orm_dag_links = orm_dag.dag_owner_links or []
+ for orm_dag_link in orm_dag_links:
+ if orm_dag_link not in dag.owner_links:
+ session.delete(orm_dag_link)
+ for owner_name, owner_link in dag.owner_links.items():
+ dag_owner_orm = DagOwnerAttributes(dag_id=dag.dag_id,
owner=owner_name, link=owner_link)
+ session.add(dag_owner_orm)
Review Comment:
Hmm this could be a bit inefficient. Can we use `IN` and bulk insert to make
this at most two calls? (one for delete and one for insert)
--
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]