prutheus commented on issue #43806: URL: https://github.com/apache/airflow/issues/43806#issuecomment-2469048801
The issue ``` sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedObject) constraint "dsdar_dag_id_fkey" of relation "dag_schedule_asset_alias_reference" does not exist [SQL: ALTER TABLE dag_schedule_asset_alias_reference DROP CONSTRAINT dsdar_dag_id_fkey] ``` seems to have an invalid fkey definition for the table `dag_schedule_asset_alias_reference`. Scanning migrations for this (https://github.com/search?q=repo%3Aapache%2Fairflow+dsdar_dag_id_fkey&type=code), I found https://github.com/apache/airflow/blob/9ee9e52dc6e6355cd655636caadbab739cae2546/airflow/migrations/versions/0041_3_0_0_rename_dataset_as_asset.py#L198 It seems that the rename migration is missing. ``` airflow=# \d dag_schedule_dataset_alias_reference Table "public.dag_schedule_dataset_alias_reference" Column | Type | Collation | Nullable | Default ------------+--------------------------+-----------+----------+--------- alias_id | integer | | not null | dag_id | character varying(250) | | not null | created_at | timestamp with time zone | | not null | updated_at | timestamp with time zone | | not null | Indexes: "dsdar_pkey" PRIMARY KEY, btree (alias_id, dag_id) "idx_dag_schedule_dataset_alias_reference_dag_id" btree (dag_id) Foreign-key constraints: "dsdar_dag_fkey" FOREIGN KEY (dag_id) REFERENCES dag(dag_id) ON DELETE CASCADE "dsdar_dataset_alias_fkey" FOREIGN KEY (alias_id) REFERENCES dataset_alias(id) ON DELETE CASCADE ``` I have `dsdar_dag_fkey` in my table `dag_schedule_dataset_alias_reference` and not `dsdar_dag_id_fkey`. **Resolved** by re-creating the fkey with the new name: ``` $ ALTER TABLE dag_schedule_dataset_alias_reference DROP CONSTRAINT dsdar_dag_fkey; $ ALTER TABLE dag_schedule_dataset_alias_reference ADD CONSTRAINT dsdar_dag_id_fkey FOREIGN KEY (dag_id) REFERENCES dag(dag_id) ON DELETE CASCADE; ``` -- 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]
