kaxil commented on a change in pull request #12586:
URL: https://github.com/apache/airflow/pull/12586#discussion_r530020374
##########
File path: airflow/models/serialized_dag.py
##########
@@ -73,8 +73,7 @@ class SerializedDagModel(Base):
dag_runs = relationship(
DagRun,
- primaryjoin=dag_id == DagRun.dag_id,
- foreign_keys=dag_id,
+ primaryjoin=dag_id == foreign(DagRun.dag_id),
Review comment:
Looks like the CI failed with following error:
```
sqlalchemy.exc.InvalidRequestError: One or more mappers failed to initialize
- can't proceed with initialization of other mappers. Triggering mapper:
'mapped class SerializedDagModel->serialized_dag'. Original exception was:
Could not locate any relevant foreign key columns for primary join condition
'serialized_dag.dag_id = dag_run.dag_id' on relationship
SerializedDagModel.dag_runs. Ensure that referencing columns are associated
with a ForeignKey or ForeignKeyConstraint, or are annotated in the join
condition with the foreign() annotation.
```
So indeed it looks like we do need `foreign`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]