ephraimbuddy commented on code in PR #44790:
URL: https://github.com/apache/airflow/pull/44790#discussion_r1882570269
##########
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:
```
$ SQLALCHEMY_WARN_20=1 python2 -W always::DeprecationWarning test3.py
test3.py:9: RemovedIn20Warning: The Engine.execute() function/method is
considered legacy as of the 1.x series of SQLAlchemy and will be removed in
2.0. All statement execution in SQLAlchemy 2.0 is performed by the
Connection.execute() method of Connection, or in the ORM by the
Session.execute() method of Session. (Background on SQLAlchemy 2.0 at:
https://sqlalche.me/e/b8d9) (Background on SQLAlchemy 2.0 at:
https://sqlalche.me/e/b8d9)
engine.execute("CREATE TABLE foo (id integer)")
/home/classic/dev/sqlalchemy/lib/sqlalchemy/engine/base.py:2856:
RemovedIn20Warning: Passing a string to Connection.execute() is deprecated and
will be removed in version 2.0. Use the text() construct, or the
Connection.exec_driver_sql() method to invoke a driver-level SQL string.
(Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
return connection.execute(statement, *multiparams, **params)
```
--
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]