kaxil commented on code in PR #44790:
URL: https://github.com/apache/airflow/pull/44790#discussion_r1882599519
##########
airflow/migrations/versions/0038_3_0_0_add_asset_active.py:
##########
@@ -76,13 +72,11 @@ def downgrade():
batch_op.add_column(
sa.Column("is_orphaned", sa.Boolean, default=False,
nullable=False, server_default="0")
)
- with Session(bind=op.get_bind()) as session:
- session.execute(
- sa.text(
- "update dataset set is_orphaned = true "
- "where exists (select 1 from asset_active "
- "where dataset.name = asset_active.name and dataset.uri =
asset_active.uri)"
- )
+ op.execute(
+ sa.text(
+ "update dataset set is_orphaned = true "
+ "where exists (select 1 from asset_active "
+ "where dataset.name = asset_active.name and dataset.uri =
asset_active.uri)"
Review Comment:
Alembic should do that for us when using `op.execute`
(`~alembic.operations.Operations.execute`). I can understand we need it for
`conn.execute(` (where `conn` is `~sqlalchemy.engine.Connection`).
Check Alembic docs here:
https://alembic.sqlalchemy.org/en/latest/ops.html#alembic.operations.Operations.execute.params.sqltext
<img width="771" alt="image"
src="https://github.com/user-attachments/assets/4cfa9483-d109-4c81-a3fa-657098019d44"
/>
--
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]