This is an automated email from the ASF dual-hosted git repository.
Lee-W pushed a commit to branch v3-4-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-4-test by this push:
new 59aba375a30 [v3-4-test] Stop SQLAlchemy subquery warning when loading
the latest serialized Dag (#73461) (#77359)
59aba375a30 is described below
commit 59aba375a30d9591392710714038aa7bdbd89ab2
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Nov 20 02:18:26 2026 +0000
[v3-4-test] Stop SQLAlchemy subquery warning when loading the latest
serialized Dag (#73461) (#77359)
On MySQL deployments every lookup of the latest serialized Dag emits a
"implicitly coercing SELECT object to scalar subquery" SAWarning, so routine
operations such as `airflow tasks clear` or opening the grid view spam the
logs and bury warnings that actually matter. The generated SQL is identical
either way.
* Turn implicit scalar subquery coercion warning into a test error
Without this the SAWarning only shows up in logs, so a regression in
the MySQL branch of latest_item_select_object could come back unnoticed.
Erroring on it makes the MySQL backend tests fail instead, the same way
the IN() coercion variant is guarded.
(cherry picked from commit 943c8ffcebced74d5b10ff1eb58ec7fcf2b768f8)
Co-authored-by: Andrii Roiko <[email protected]>
---
airflow-core/src/airflow/models/serialized_dag.py | 2 +-
pyproject.toml | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/airflow-core/src/airflow/models/serialized_dag.py
b/airflow-core/src/airflow/models/serialized_dag.py
index 3d7ca46566c..b1326d72b71 100644
--- a/airflow-core/src/airflow/models/serialized_dag.py
+++ b/airflow-core/src/airflow/models/serialized_dag.py
@@ -837,7 +837,7 @@ class SerializedDagModel(Base):
.order_by(DagVersion.version_number.desc())
.limit(1)
)
- return select(cls).where(cls.id == latest_item_id)
+ return select(cls).where(cls.id ==
latest_item_id.scalar_subquery())
return (
select(cls)
.join(DagVersion, cls.dag_version_id == DagVersion.id)
diff --git a/pyproject.toml b/pyproject.toml
index 8eea578f45f..ecab868f62f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1028,6 +1028,7 @@ filterwarnings = [
# Avoid building cartesian product which might impact performance
"error:SELECT statement has a cartesian product between
FROM:sqlalchemy.exc.SAWarning:airflow",
'error:Coercing Subquery object into a select\(\) for use in
IN\(\):sqlalchemy.exc.SAWarning:airflow',
+ 'error:implicitly coercing SELECT object to scalar
subquery:sqlalchemy.exc.SAWarning:airflow',
'error:Class.*will not make use of SQL compilation caching',
"ignore::DeprecationWarning:flask_appbuilder.filemanager",
"ignore::DeprecationWarning:flask_appbuilder.widgets",