ephraimbuddy commented on code in PR #31486:
URL: https://github.com/apache/airflow/pull/31486#discussion_r1205300363
##########
airflow/utils/db.py:
##########
@@ -1004,15 +1010,17 @@ def reflect_tables(tables: list[Base | str] | None,
session):
"""
import sqlalchemy.schema
- metadata = sqlalchemy.schema.MetaData(session.bind)
+ bind = session.bind
+ metadata = sqlalchemy.schema.MetaData()
+ metadata.bind = bind
if tables is None:
- metadata.reflect(resolve_fks=False)
+ metadata.reflect(bind=bind, resolve_fks=False)
else:
for tbl in tables:
try:
table_name = tbl if isinstance(tbl, str) else tbl.__tablename__
- metadata.reflect(only=[table_name], extend_existing=True,
resolve_fks=False)
+ metadata.reflect(bind=bind, only=[table_name],
extend_existing=True, resolve_fks=False)
Review Comment:
Yeah. It was surprising to me too. Here's the warning that it throws:
```
/opt/airflow/airflow/utils/db.py:1023 RemovedIn20Warning: The ``bind``
argument for schema methods that invoke SQL against an engine or connection
will be required in SQLAlchemy 2.0. (Background on SQLAlchemy 2.0 at:
https://sqlalche.me/e/b8d9)
```
--
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]