Dev-iL commented on code in PR #69469:
URL: https://github.com/apache/airflow/pull/69469#discussion_r3534598423
##########
airflow-core/src/airflow/migrations/versions/0017_2_9_2_fix_inconsistency_between_ORM_and_migration_files.py:
##########
@@ -110,7 +110,7 @@ def upgrade():
batch_op.create_unique_constraint(batch_op.f("connection_conn_id_uq"),
["conn_id"])
max_cons = sa.table("dag", sa.column("max_consecutive_failed_dag_runs"))
-
op.execute(max_cons.update().values(max_consecutive_failed_dag_runs=literal("0")))
+
op.execute(max_cons.update().values(max_consecutive_failed_dag_runs=literal(0)))
Review Comment:
It is safe to modify the old migration because a str literal makes
SQLAlchemy emit an explicit `::VARCHAR` cast, which psycopg (v3) enforces
literally against this integer column (DatatypeMismatch). psycopg2 ignores the
cast and lets Postgres coerce the text implicitly, so both drivers persist the
same value either way.
Re other backends - compiling that exact statement against all three
SQLAlchemy dialects shows only the `postgresql+psycopg` dialect ever adds a
cast — `UPDATE dag SET
max_consecutive_failed_dag_runs=%(max_consecutive_failed_dag_runs)s` for plain
`postgresql`, `=%s` for `mysql`, `=?` for `sqlite`, none of them casting.
--
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]