This is an automated email from the ASF dual-hosted git repository. kaxilnaik pushed a commit to branch v3-0-test in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 9c5841cd20184c2f88db5250861514525c63d0f2 Author: Kalyan R <[email protected]> AuthorDate: Thu Apr 24 09:04:47 2025 +0530 fix a few sqlalchemy deprecation warnings (#49477) * fix sqlA warning in taskinstance.py * fix deprecation in migration: 0059 * fix few more deprecations * remove usage of _mapping * run pre-commit to update erd (cherry picked from commit 859c11e666d7c25030674eed19048cb446a2c227) --- airflow-core/docs/img/airflow_erd.sha256 | 2 +- .../src/airflow/api_fastapi/execution_api/routes/task_instances.py | 2 +- .../migrations/versions/0059_3_0_0_remove_external_trigger_field.py | 2 +- airflow-core/src/airflow/models/taskinstance.py | 3 +-- airflow-core/tests/unit/dag_processing/test_manager.py | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/airflow-core/docs/img/airflow_erd.sha256 b/airflow-core/docs/img/airflow_erd.sha256 index fae49f1bfab..092206c40d2 100644 --- a/airflow-core/docs/img/airflow_erd.sha256 +++ b/airflow-core/docs/img/airflow_erd.sha256 @@ -1 +1 @@ -94023084fb9e30f248831a04f0bbabf5b7d90332b7edc013c7a5305340c4e1bf \ No newline at end of file +b0d903c5eb9b35579175fc8068d422c4656cc6fcf7d65eb65c4616c7e8173cf0 \ No newline at end of file diff --git a/airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py b/airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py index 95ec3f43db1..720d5653f32 100644 --- a/airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py +++ b/airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py @@ -141,7 +141,7 @@ def ti_run( # If we are already running, but this is a duplicate request from the same client return the same OK # -- it's possible there was a network glitch and they never got the response - if previous_state == TaskInstanceState.RUNNING and (ti["hostname"], ti["unixname"], ti["pid"]) == ( + if previous_state == TaskInstanceState.RUNNING and (ti.hostname, ti.unixname, ti.pid) == ( ti_run_payload.hostname, ti_run_payload.unixname, ti_run_payload.pid, diff --git a/airflow-core/src/airflow/migrations/versions/0059_3_0_0_remove_external_trigger_field.py b/airflow-core/src/airflow/migrations/versions/0059_3_0_0_remove_external_trigger_field.py index f559cf9f8d8..46d3cd9ca57 100644 --- a/airflow-core/src/airflow/migrations/versions/0059_3_0_0_remove_external_trigger_field.py +++ b/airflow-core/src/airflow/migrations/versions/0059_3_0_0_remove_external_trigger_field.py @@ -53,6 +53,6 @@ def downgrade(): ) op.execute( dag_run_table.update().values( - external_trigger=sa.case([(dag_run_table.c.run_type == "manual", True)], else_=False) + external_trigger=sa.case((dag_run_table.c.run_type == "manual", True), else_=False) ) ) diff --git a/airflow-core/src/airflow/models/taskinstance.py b/airflow-core/src/airflow/models/taskinstance.py index 5cf657a36f3..52c1d7d5e8e 100644 --- a/airflow-core/src/airflow/models/taskinstance.py +++ b/airflow-core/src/airflow/models/taskinstance.py @@ -1052,8 +1052,7 @@ class TaskInstance(Base, LoggingMixin): """ query = select( # Select the columns, not the ORM object, to bypass any session/ORM caching layer - c - for c in TaskInstance.__table__.columns + *TaskInstance.__table__.columns ).filter_by( dag_id=self.dag_id, run_id=self.run_id, diff --git a/airflow-core/tests/unit/dag_processing/test_manager.py b/airflow-core/tests/unit/dag_processing/test_manager.py index 9479fb0e303..3c180afa76b 100644 --- a/airflow-core/tests/unit/dag_processing/test_manager.py +++ b/airflow-core/tests/unit/dag_processing/test_manager.py @@ -414,7 +414,7 @@ class TestDagFileProcessorManager: assert manager._file_queue == deque([file1, file2]) assert manager._force_refresh_bundles == {"dags-folder"} with create_session() as session2: - parsing_request_after = session2.query(DagPriorityParsingRequest).get(parsing_request.id) + parsing_request_after = session2.get(DagPriorityParsingRequest, parsing_request.id) assert parsing_request_after is None def test_parsing_requests_only_bundles_being_parsed(self, testing_dag_bundle):
