You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Lee-W (via GitHub)" <gi...@apache.org> on 2024/10/23 14:03:28 UTC
[PR] fix typo in dag_schedule_dataset_alias_reference migration file [airflow]
Lee-W opened a new pull request, #43314:
URL: https://github.com/apache/airflow/pull/43314
backport https://github.com/apache/airflow/pull/43245/files#diff-465bfca34e4030692c541248495b5abfe4deea606db126241dade041746fbd60
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of an existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
<!-- Please keep an empty line above the dashes. -->
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix typo in dag_schedule_dataset_alias_reference migration file [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on PR #43314:
URL: https://github.com/apache/airflow/pull/43314#issuecomment-2435932918
> > Hmm not so sure about just renaming constraints. What about folks who are already on this version?
>
> These reflect how the actual model is defined. As no feature is expected to be added to this version, I think these columns won't change in the future either.
If you download Airflow 2.10.2 and run airflow db migrate with Postgres or MySQL backend the constraints are created with the old names. Example:
<img width="325" alt="image" src="https://github.com/user-attachments/assets/8e9b791e-b845-42da-ad23-04ef845cbf85">
If we merge and ship this change, we will have some users with `dsdar_dag_fkey` as name of constraint and some on `dsdar_dataset_alias_fkey`. In future we need to access a constraint via name that won't work for some users.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix typo in dag_schedule_dataset_alias_reference migration file [airflow]
Posted by "shahar1 (via GitHub)" <gi...@apache.org>.
shahar1 commented on PR #43314:
URL: https://github.com/apache/airflow/pull/43314#issuecomment-2432393747
Static checks fail for some reason, I assume that it's not related
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix typo in dag_schedule_dataset_alias_reference migration file [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on PR #43314:
URL: https://github.com/apache/airflow/pull/43314#issuecomment-2439246339
> Also I guess it should be back-ported ?
This is for 2.10.x, but I guess what you mean is for main and yes, the PR is here https://github.com/apache/airflow/pull/43373
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix typo in dag_schedule_dataset_alias_reference migration file [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #43314:
URL: https://github.com/apache/airflow/pull/43314#issuecomment-2436096428
Yep. Agree with @kaxil. That should be a separate migration. Also the original cahnge in main should be reverted and re-applied after that because people will go eventually 2.x -> 2.11 -> 3.x and things will break for them.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix typo in dag_schedule_dataset_alias_reference migration file [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #43314:
URL: https://github.com/apache/airflow/pull/43314#discussion_r1816982650
##########
airflow/migrations/versions/0152_2_10_3_fix_dag_schedule_dataset_alias_reference_naming.py:
##########
@@ -0,0 +1,123 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""
+Rename dag_schedule_dataset_alias_reference constraint names.
+
+Revision ID: 5f2621c13b39
+Revises: 22ed7efa9da2
+Create Date: 2024-10-25 04:03:33.002701
+
+"""
+
+from __future__ import annotations
+
+from typing import TYPE_CHECKING
+
+from alembic import op
+from sqlalchemy import inspect
+
+# revision identifiers, used by Alembic.
+revision = "5f2621c13b39"
+down_revision = "22ed7efa9da2"
+branch_labels = None
+depends_on = None
+airflow_version = "2.10.3"
+
+if TYPE_CHECKING:
+ from alembic.operations.base import BatchOperations
+ from sqlalchemy.sql.elements import conv
+
+
+def _rename_fk_constraint(
+ *,
+ batch_op: BatchOperations,
+ original_name: str | conv,
+ new_name: str | conv,
+ referent_table: str,
+ local_cols: list[str],
+ remote_cols: list[str],
+ ondelete: str,
+) -> None:
+ batch_op.drop_constraint(original_name, type_="foreignkey")
+ batch_op.create_foreign_key(
+ constraint_name=new_name,
+ referent_table=referent_table,
+ local_cols=local_cols,
+ remote_cols=remote_cols,
+ ondelete=ondelete,
+ )
+
+
+def upgrade():
+ """Rename dag_schedule_dataset_alias_reference constraint."""
+ with op.batch_alter_table("dag_schedule_dataset_alias_reference", schema=None) as batch_op:
+ bind = op.get_context().bind
+ insp = inspect(bind)
+ fk_constraints = [fk["name"] for fk in insp.get_foreign_keys("dag_schedule_dataset_alias_reference")]
+
+ # "dsdar_dataset_alias_fkey" was the constraint name defined in the model while "dsdar_dataset_fkey" is the one
+ # defined in the previous migration.
+ # Rename this constraint name if user is using the name "dsdar_dataset_fkey".
+ if "dsdar_dataset_fkey" in fk_constraints:
+ _rename_fk_constraint(
+ batch_op=batch_op,
+ original_name="dsdar_dataset_fkey",
+ new_name="dsdar_dataset_alias_fkey",
+ referent_table="dataset_alias",
+ local_cols=["alias_id"],
+ remote_cols=["id"],
+ ondelete="CASCADE",
+ )
+
+ # "dsdar_dag_fkey" was the constraint name defined in the model while "dsdar_dag_id_fkey" is the one
+ # defined in the previous migration.
+ # Rename this constraint name if user is using the name "dsdar_dag_fkey".
+ if "dsdar_dag_fkey" in fk_constraints:
+ _rename_fk_constraint(
+ batch_op=batch_op,
+ original_name="dsdar_dag_fkey",
+ new_name="dsdar_dag_id_fkey",
+ referent_table="dataset_alias",
+ local_cols=["alias_id"],
+ remote_cols=["id"],
+ ondelete="CASCADE",
+ )
+
+
+def downgrade():
+ """Undo dag_schedule_dataset_alias_reference constraint rename."""
+ with op.batch_alter_table("dag_schedule_dataset_alias_reference", schema=None) as batch_op:
+ _rename_fk_constraint(
+ batch_op=batch_op,
+ original_name="dsdar_dataset_alias_fkey",
+ new_name="dsdar_dataset_fkey",
+ referent_table="dataset_alias",
+ local_cols=["alias_id"],
+ remote_cols=["id"],
+ ondelete="CASCADE",
+ )
+ _rename_fk_constraint(
+ batch_op=batch_op,
+ original_name="dsdar_dag_id_fkey",
+ new_name="dsdar_dag_fkey",
+ referent_table="dataset_alias",
+ local_cols=["alias_id"],
+ remote_cols=["id"],
+ ondelete="CASCADE",
+ )
Review Comment:
You will need same "if" condition so it doesn't try to drop a constraint that doesn't exist
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix typo in dag_schedule_dataset_alias_reference migration file [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W merged PR #43314:
URL: https://github.com/apache/airflow/pull/43314
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix typo in dag_schedule_dataset_alias_reference migration file [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #43314:
URL: https://github.com/apache/airflow/pull/43314#discussion_r1816963425
##########
airflow/migrations/versions/0152_2_10_3_fix_dag_schedule_dataset_alias_reference_naming.py:
##########
@@ -0,0 +1,119 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""
+Rename dag_schedule_dataset_alias_reference constraint names.
+
+Revision ID: 5f2621c13b39
+Revises: 22ed7efa9da2
+Create Date: 2024-10-25 04:03:33.002701
+
+"""
+
+from __future__ import annotations
+
+from typing import TYPE_CHECKING
+
+from alembic import op
+from sqlalchemy import inspect
+
+# revision identifiers, used by Alembic.
+revision = "5f2621c13b39"
+down_revision = "22ed7efa9da2"
+branch_labels = None
+depends_on = None
+airflow_version = "2.10.3"
+
+if TYPE_CHECKING:
+ from alembic.operations.base import BatchOperations
+ from sqlalchemy.sql.elements import conv
+
+
+def _rename_fk_constraint(
+ *,
+ batch_op: BatchOperations,
+ original_name: str | conv,
+ new_name: str | conv,
+ referent_table: str,
+ local_cols: list[str],
+ remote_cols: list[str],
+ ondelete: str,
+) -> None:
+ batch_op.drop_constraint(original_name, type_="foreignkey")
+ batch_op.create_foreign_key(
+ constraint_name=new_name,
+ referent_table=referent_table,
+ local_cols=local_cols,
+ remote_cols=remote_cols,
+ ondelete=ondelete,
+ )
+
+
+def upgrade():
+ """Rename dag_schedule_dataset_alias_reference constraint."""
+ with op.batch_alter_table("dag_schedule_dataset_alias_reference", schema=None) as batch_op:
+ _rename_fk_constraint(
+ batch_op=batch_op,
+ original_name="dsdar_dataset_fkey",
+ new_name="dsdar_dataset_alias_fkey",
+ referent_table="dataset_alias",
+ local_cols=["alias_id"],
+ remote_cols=["id"],
+ ondelete="CASCADE",
+ )
Review Comment:
Thanks! Just updated 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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix typo in dag_schedule_dataset_alias_reference migration file [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #43314:
URL: https://github.com/apache/airflow/pull/43314#discussion_r1816930598
##########
airflow/models/dataset.py:
##########
@@ -224,7 +224,7 @@ class DagScheduleDatasetAliasReference(Base):
ForeignKeyConstraint(
columns=(dag_id,),
refcolumns=["dag.dag_id"],
- name="dsdar_dag_fkey",
+ name="dsdar_dag_id_fkey",
Review Comment:
The new name is `dsdar_dag_id_fkey` https://github.com/apache/airflow/pull/43314/files#diff-9f8b52e67c9d3378cd4716e7aa729ec0402970d3c4d3b1f9e3316d390fb85b23R95
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix typo in dag_schedule_dataset_alias_reference migration file [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #43314:
URL: https://github.com/apache/airflow/pull/43314#discussion_r1816494783
##########
airflow/models/dataset.py:
##########
@@ -224,7 +224,7 @@ class DagScheduleDatasetAliasReference(Base):
ForeignKeyConstraint(
columns=(dag_id,),
refcolumns=["dag.dag_id"],
- name="dsdar_dag_fkey",
+ name="dsdar_dag_id_fkey",
Review Comment:
hmm? If the new name of contraint in migration is `dsdar_dag_fkey`, why are we changing this?
##########
airflow/models/dataset.py:
##########
@@ -224,7 +224,7 @@ class DagScheduleDatasetAliasReference(Base):
ForeignKeyConstraint(
columns=(dag_id,),
refcolumns=["dag.dag_id"],
- name="dsdar_dag_fkey",
+ name="dsdar_dag_id_fkey",
Review Comment:
hmm? If the new name of constraint in migration is `dsdar_dag_fkey`, why are we changing this?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix typo in dag_schedule_dataset_alias_reference migration file [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #43314:
URL: https://github.com/apache/airflow/pull/43314#discussion_r1816493559
##########
airflow/migrations/versions/0152_2_10_3_fix_dag_schedule_dataset_alias_reference_naming.py:
##########
@@ -0,0 +1,119 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""
+Rename dag_schedule_dataset_alias_reference constraint names.
+
+Revision ID: 5f2621c13b39
+Revises: 22ed7efa9da2
+Create Date: 2024-10-25 04:03:33.002701
+
+"""
+
+from __future__ import annotations
+
+from typing import TYPE_CHECKING
+
+from alembic import op
+from sqlalchemy import inspect
+
+# revision identifiers, used by Alembic.
+revision = "5f2621c13b39"
+down_revision = "22ed7efa9da2"
+branch_labels = None
+depends_on = None
+airflow_version = "2.10.3"
+
+if TYPE_CHECKING:
+ from alembic.operations.base import BatchOperations
+ from sqlalchemy.sql.elements import conv
+
+
+def _rename_fk_constraint(
+ *,
+ batch_op: BatchOperations,
+ original_name: str | conv,
+ new_name: str | conv,
+ referent_table: str,
+ local_cols: list[str],
+ remote_cols: list[str],
+ ondelete: str,
+) -> None:
+ batch_op.drop_constraint(original_name, type_="foreignkey")
+ batch_op.create_foreign_key(
+ constraint_name=new_name,
+ referent_table=referent_table,
+ local_cols=local_cols,
+ remote_cols=remote_cols,
+ ondelete=ondelete,
+ )
+
+
+def upgrade():
+ """Rename dag_schedule_dataset_alias_reference constraint."""
+ with op.batch_alter_table("dag_schedule_dataset_alias_reference", schema=None) as batch_op:
+ _rename_fk_constraint(
+ batch_op=batch_op,
+ original_name="dsdar_dataset_fkey",
+ new_name="dsdar_dataset_alias_fkey",
+ referent_table="dataset_alias",
+ local_cols=["alias_id"],
+ remote_cols=["id"],
+ ondelete="CASCADE",
+ )
Review Comment:
Unfortunately, we will have to do a little more here @Lee-W because we already have the case where the constraint is named differently for 2 different sets of users:
It is named
1. `dsdar_dataset_fkey `: for 2.8.0 -> 2.10.2: because they are created from migration
2. `dsdar_dataset_alias_fkey`: for new install 2.10.2: because they are created from model
So you will have to do similar if/else condition as you did on L85. Otherwise this might result in constraint not found error for folks with Case (2) above
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix typo in dag_schedule_dataset_alias_reference migration file [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #43314:
URL: https://github.com/apache/airflow/pull/43314#discussion_r1816991168
##########
airflow/migrations/versions/0152_2_10_3_fix_dag_schedule_dataset_alias_reference_naming.py:
##########
@@ -0,0 +1,123 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""
+Rename dag_schedule_dataset_alias_reference constraint names.
+
+Revision ID: 5f2621c13b39
+Revises: 22ed7efa9da2
+Create Date: 2024-10-25 04:03:33.002701
+
+"""
+
+from __future__ import annotations
+
+from typing import TYPE_CHECKING
+
+from alembic import op
+from sqlalchemy import inspect
+
+# revision identifiers, used by Alembic.
+revision = "5f2621c13b39"
+down_revision = "22ed7efa9da2"
+branch_labels = None
+depends_on = None
+airflow_version = "2.10.3"
+
+if TYPE_CHECKING:
+ from alembic.operations.base import BatchOperations
+ from sqlalchemy.sql.elements import conv
+
+
+def _rename_fk_constraint(
+ *,
+ batch_op: BatchOperations,
+ original_name: str | conv,
+ new_name: str | conv,
+ referent_table: str,
+ local_cols: list[str],
+ remote_cols: list[str],
+ ondelete: str,
+) -> None:
+ batch_op.drop_constraint(original_name, type_="foreignkey")
+ batch_op.create_foreign_key(
+ constraint_name=new_name,
+ referent_table=referent_table,
+ local_cols=local_cols,
+ remote_cols=remote_cols,
+ ondelete=ondelete,
+ )
+
+
+def upgrade():
+ """Rename dag_schedule_dataset_alias_reference constraint."""
+ with op.batch_alter_table("dag_schedule_dataset_alias_reference", schema=None) as batch_op:
+ bind = op.get_context().bind
+ insp = inspect(bind)
+ fk_constraints = [fk["name"] for fk in insp.get_foreign_keys("dag_schedule_dataset_alias_reference")]
+
+ # "dsdar_dataset_alias_fkey" was the constraint name defined in the model while "dsdar_dataset_fkey" is the one
+ # defined in the previous migration.
+ # Rename this constraint name if user is using the name "dsdar_dataset_fkey".
+ if "dsdar_dataset_fkey" in fk_constraints:
+ _rename_fk_constraint(
+ batch_op=batch_op,
+ original_name="dsdar_dataset_fkey",
+ new_name="dsdar_dataset_alias_fkey",
+ referent_table="dataset_alias",
+ local_cols=["alias_id"],
+ remote_cols=["id"],
+ ondelete="CASCADE",
+ )
+
+ # "dsdar_dag_fkey" was the constraint name defined in the model while "dsdar_dag_id_fkey" is the one
+ # defined in the previous migration.
+ # Rename this constraint name if user is using the name "dsdar_dag_fkey".
+ if "dsdar_dag_fkey" in fk_constraints:
+ _rename_fk_constraint(
+ batch_op=batch_op,
+ original_name="dsdar_dag_fkey",
+ new_name="dsdar_dag_id_fkey",
+ referent_table="dataset_alias",
+ local_cols=["alias_id"],
+ remote_cols=["id"],
+ ondelete="CASCADE",
+ )
+
+
+def downgrade():
+ """Undo dag_schedule_dataset_alias_reference constraint rename."""
+ with op.batch_alter_table("dag_schedule_dataset_alias_reference", schema=None) as batch_op:
+ _rename_fk_constraint(
+ batch_op=batch_op,
+ original_name="dsdar_dataset_alias_fkey",
+ new_name="dsdar_dataset_fkey",
+ referent_table="dataset_alias",
+ local_cols=["alias_id"],
+ remote_cols=["id"],
+ ondelete="CASCADE",
+ )
+ _rename_fk_constraint(
+ batch_op=batch_op,
+ original_name="dsdar_dag_id_fkey",
+ new_name="dsdar_dag_fkey",
+ referent_table="dataset_alias",
+ local_cols=["alias_id"],
+ remote_cols=["id"],
+ ondelete="CASCADE",
+ )
Review Comment:
I can't think of a case that it won't exist 🤔 but no harm to safe guard. will update 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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix typo in dag_schedule_dataset_alias_reference migration file [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on PR #43314:
URL: https://github.com/apache/airflow/pull/43314#issuecomment-2433919695
> Hmm not so sure about just renaming constraints. What about folks who are already on this version?
These reflect how the actual model is defined. As no feature is expected to be added to this version, I think these columns won't change in the future either.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix typo in dag_schedule_dataset_alias_reference migration file [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #43314:
URL: https://github.com/apache/airflow/pull/43314#discussion_r1816930598
##########
airflow/models/dataset.py:
##########
@@ -224,7 +224,7 @@ class DagScheduleDatasetAliasReference(Base):
ForeignKeyConstraint(
columns=(dag_id,),
refcolumns=["dag.dag_id"],
- name="dsdar_dag_fkey",
+ name="dsdar_dag_id_fkey",
Review Comment:
The new name is `dsdar_dag_id_fkey` https://github.com/apache/airflow/pull/43314/files#diff-9f8b52e67c9d3378cd4716e7aa729ec0402970d3c4d3b1f9e3316d390fb85b23R91
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix typo in dag_schedule_dataset_alias_reference migration file [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #43314:
URL: https://github.com/apache/airflow/pull/43314#issuecomment-2438718759
Also I guess it should be back-ported ?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix typo in dag_schedule_dataset_alias_reference migration file [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on PR #43314:
URL: https://github.com/apache/airflow/pull/43314#issuecomment-2436835934
Got it. makes sense. I will create a fix pr to the main as well
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org