kaxil commented on code in PR #73173:
URL: https://github.com/apache/airflow/pull/73173#discussion_r4025383233
##########
airflow-core/src/airflow/utils/db_cleanup.py:
##########
@@ -145,6 +171,20 @@ def __post_init__(self):
schema=self.schema_name,
)
+ if self.dag_id_scope is not None:
+ if self.dag_id_column_name is not None:
+ raise ValueError(
+ f"_TableConfig for table {self.table_name!r} sets both
dag_id_column_name and "
+ f"dag_id_scope; a table is scoped to a Dag either by its
own column or through a "
+ f"foreign key, not both."
+ )
+ if self.dag_id_scope.fk_column not in self.orm_model.c.keys():
+ raise ValueError(
+ f"_TableConfig for table {self.table_name!r} sets
dag_id_scope but its "
+ f"fk_column {self.dag_id_scope.fk_column!r} is not one of
its columns; "
+ f"add {self.dag_id_scope.fk_column!r} to extra_columns."
+ )
Review Comment:
Added two, `test_table_config_rejects_both_dag_id_column_and_scope` and
`test_table_config_dag_id_scope_requires_fk_column`. Both fail with DID NOT
RAISE if the validation block is removed.
--
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]