ashb commented on code in PR #24743:
URL: https://github.com/apache/airflow/pull/24743#discussion_r912882296


##########
airflow/models/dag.py:
##########
@@ -2509,6 +2524,67 @@ def bulk_write_to_db(cls, dags: Collection["DAG"], 
session=NEW_SESSION):
 
         DagCode.bulk_sync_to_db(filelocs, session=session)
 
+        from airflow.models.dataset import Dataset
+        from airflow.models.dataset_dag_ref import DatasetDagRef
+        from airflow.models.dataset_task_ref import DatasetTaskRef

Review Comment:
   If we define the relationships right in SQLA I feel that we shouldn't need 
to use these classes directly, and instead should be able do do something like 
`dag_model.outlet_datasets:
   
   ```python
   dag_model.outlet_datasets.append(DatasetModel(...))
   ```
   
   I can't find the right page in the SQLA docs that talks specifically about 
this but 
https://docs.sqlalchemy.org/en/14/orm/basic_relationships.html#association-object
 does show it.



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