You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by we...@apache.org on 2024/10/28 01:44:41 UTC

(airflow) branch main updated: Resolve warning in Dataset Alias migration (#43421)

This is an automated email from the ASF dual-hosted git repository.

weilee pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new f6ce1fd70ef Resolve warning in Dataset Alias migration (#43421)
f6ce1fd70ef is described below

commit f6ce1fd70efbbd5cc23f5e9dfa5751a494d0fe81
Author: Kaxil Naik <ka...@apache.org>
AuthorDate: Mon Oct 28 01:44:34 2024 +0000

    Resolve warning in Dataset Alias migration (#43421)
    
    This PR resolves an SQLAlchemy warning in the migration by correctly setting the `alias_id` column as part of the primary key in the `dag_schedule_dataset_alias_reference` table. Previously, only dag_id was marked as the primary key, causing a mismatch with the local definition, which triggered an SAWarning.
    
    Example: https://github.com/apache/airflow/actions/runs/11526187767/job/32090094094?pr=43243#step:6:745
    
    ```
    /opt/airflow/airflow/migrations/versions/0026_2_10_0_dag_schedule_dataset_alias_reference.py:46 SAWarning: Table 'dag_schedule_dataset_alias_reference' specifies columns 'dag_id' as primary_key=True, not matching locally specified columns 'alias_id', 'dag_id'; setting the current primary key columns to 'alias_id', 'dag_id'. This warning may become an exception in a future release
    ```
    
    I verified that both columns are marked as primary keys already in 2.10.
---
 .../versions/0026_2_10_0_dag_schedule_dataset_alias_reference.py        | 2 +-
 docs/apache-airflow/img/airflow_erd.sha256                              | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/airflow/migrations/versions/0026_2_10_0_dag_schedule_dataset_alias_reference.py b/airflow/migrations/versions/0026_2_10_0_dag_schedule_dataset_alias_reference.py
index d266340312f..f4c11a7b006 100644
--- a/airflow/migrations/versions/0026_2_10_0_dag_schedule_dataset_alias_reference.py
+++ b/airflow/migrations/versions/0026_2_10_0_dag_schedule_dataset_alias_reference.py
@@ -45,7 +45,7 @@ def upgrade():
     """Add dag_schedule_dataset_alias_reference table."""
     op.create_table(
         "dag_schedule_dataset_alias_reference",
-        sa.Column("alias_id", sa.Integer(), nullable=False),
+        sa.Column("alias_id", sa.Integer(), primary_key=True, nullable=False),
         sa.Column("dag_id", StringID(), primary_key=True, nullable=False),
         sa.Column("created_at", airflow.utils.sqlalchemy.UtcDateTime(timezone=True), nullable=False),
         sa.Column("updated_at", airflow.utils.sqlalchemy.UtcDateTime(timezone=True), nullable=False),
diff --git a/docs/apache-airflow/img/airflow_erd.sha256 b/docs/apache-airflow/img/airflow_erd.sha256
index c4958d61782..e8ee39a6eba 100644
--- a/docs/apache-airflow/img/airflow_erd.sha256
+++ b/docs/apache-airflow/img/airflow_erd.sha256
@@ -1 +1 @@
-5067b6eac290220d23ce1bef6ce6d02478757f626f5a81a53ca2bba8e31c094c
\ No newline at end of file
+5958e108ee31f4ca94d6a878767d8d1ca00ef4e664ecda9308b367c173a09226
\ No newline at end of file