Taragolis commented on code in PR #39211:
URL: https://github.com/apache/airflow/pull/39211#discussion_r1577759015


##########
airflow/utils/db_cleanup.py:
##########
@@ -167,7 +168,7 @@ def _do_delete(*, query, orm_model, skip_archive, session):
         # MySQL with replication needs this split into two queries, so just do 
it for all MySQL
         # ERROR 1786 (HY000): Statement violates GTID consistency: CREATE 
TABLE ... SELECT.
         session.execute(text(f"CREATE TABLE {target_table_name} LIKE 
{orm_model.name}"))
-        metadata = reflect_tables([target_table_name], session)
+        metadata.reflect(bind, only=[target_table_name])

Review Comment:
   Seems like it doesn't fix `airflow/utils/db_cleanup.py:201`
   
   ```console
   =============================== Group 'airflow' 
================================
   Saved into file: 
/home/runner/work/airflow/airflow/files/warn-summary-group-airflow.txt
   
   Unique warnings within the test cases: 193
   
   Top 10 Tests Cases:
     airflow.exceptions.RemovedInAirflow3Warning 
tests/always/test_connection.py::TestConnection::test_connection_extra_no_encryption
 - 3 (!)
     airflow.exceptions.RemovedInAirflow3Warning 
tests/always/test_connection.py::TestConnection::test_connection_extra_with_encryption
 - 3 (!)
     airflow.exceptions.RemovedInAirflow3Warning 
tests/always/test_connection.py::TestConnection::test_connection_extra_with_encryption_rotate_fernet_key
 - 3 (!)
     airflow.exceptions.RemovedInAirflow3Warning 
tests/always/test_connection.py::TestConnection::test_connection_from_uri - 3 
(!)
     airflow.exceptions.RemovedInAirflow3Warning 
tests/always/test_connection.py::TestConnection::test_connection_get_uri_from_conn
 - 3 (!)
     airflow.exceptions.RemovedInAirflow3Warning 
tests/always/test_connection.py::TestConnection::test_connection_get_uri_from_uri
 - 3 (!)
     airflow.exceptions.RemovedInAirflow3Warning 
tests/always/test_connection.py::TestConnection::test_from_json_extra - 3 (!)
     airflow.exceptions.RemovedInAirflow3Warning 
tests/api_connexion/endpoints/test_connection_endpoint.py::TestGetConnection::test_should_respond_200
 - 3 (!)
     airflow.exceptions.RemovedInAirflow3Warning 
tests/api_connexion/schemas/test_connection_schema.py::TestConnectionSchema::test_serialize
 - 3 (!)
     airflow.exceptions.RemovedInAirflow3Warning 
tests/providers/yandex/secrets/test_lockbox.py::TestLockboxSecretBackend::test_yandex_lockbox_secret_backend_get_connection_from_json
 - 3 (!)
   
   Unique warnings: 53
   
   Warnings grouped by category:
     airflow.exceptions.RemovedInAirflow3Warning - 28 (!)
     DeprecationWarning - 13
     airflow.exceptions.AirflowProviderDeprecationWarning - 5 (!)
     UserWarning - 2
     sqlalchemy.exc.RemovedIn20Warning - 2 (!!!)
     sqlalchemy.exc.SAWarning - 2 (!!)
     FutureWarning - 1
   
   Top 10 Warnings:
     
airflow/models/connection.py:177:airflow.exceptions.RemovedInAirflow3Warning - 
5 (!)
     
airflow/models/connection.py:370:airflow.exceptions.RemovedInAirflow3Warning - 
5 (!)
     
airflow/models/connection.py:376:airflow.exceptions.RemovedInAirflow3Warning - 
5 (!)
     airflow/www/views.py:1745:airflow.exceptions.RemovedInAirflow3Warning - 2 
(!)
     airflow/utils/db.py:1069:sqlalchemy.exc.SAWarning - 2 (!!)
     
airflow/api_connexion/endpoints/forward_to_fab_endpoint.py:48:DeprecationWarning
 - 1
     airflow/cli/commands/info_command.py:232:DeprecationWarning - 1
     airflow/settings.py:196:DeprecationWarning - 1
     airflow/utils/session.py:81:DeprecationWarning - 1
     airflow/utils/session.py:84:DeprecationWarning - 1
   
   -------------------------- Always reported warnings 
4---------------------------
   airflow/utils/db.py:1069
     sqlalchemy.exc.SAWarning - Skipped unsupported reflection of 
expression-based index idx_ab_user_username
   
   airflow/utils/db.py:1069
     sqlalchemy.exc.SAWarning - Skipped unsupported reflection of 
expression-based index idx_ab_register_user_username
   
   airflow/utils/db_cleanup.py:201
     sqlalchemy.exc.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)
   
   airflow/cli/commands/task_command.py:202
     sqlalchemy.exc.RemovedIn20Warning - "TaskInstance" object is being merged 
into a Session along the backref cascade path for relationship 
"DagRun.task_instances"; in SQLAlchemy 2.0, this reverse cascade will not take 
place.  Set cascade_backrefs to False in either the relationship() or backref() 
function for the 2.0 behavior; or to set globally for the whole Session, set 
the future=True flag (Background on this error at: 
https://sqlalche.me/e/14/s9r1) (Background on SQLAlchemy 2.0 at: 
https://sqlalche.me/e/b8d9)
   ```
   
   See: 
https://github.com/apache/airflow/actions/runs/8813920521/job/24196107977?pr=39211
   And just in case warning summary artifact: [test-summarized-warnings 
(4).zip](https://github.com/apache/airflow/files/15093686/test-summarized-warnings.4.zip)
   



-- 
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]

Reply via email to