jason810496 commented on code in PR #51336:
URL: https://github.com/apache/airflow/pull/51336#discussion_r2122553361
##########
airflow-core/src/airflow/migrations/versions/0017_2_9_2_fix_inconsistency_between_ORM_and_migration_files.py:
##########
@@ -243,8 +243,12 @@ def upgrade():
)
""")
)
-
- conn.execute(sa.text("INSERT INTO dag_run_new SELECT * FROM dag_run"))
+ headers = (
+ "id, dag_id, queued_at, execution_date, start_date, end_date,
state, run_id, creating_job_id, "
+ "external_trigger, run_type, conf, data_interval_start,
data_interval_end, "
+ "last_scheduling_decision, dag_hash, log_template_id, updated_at,
clear_number"
+ )
+ conn.execute(sa.text(f"INSERT INTO dag_run_new ({headers}) SELECT
{headers} FROM dag_run"))
conn.execute(sa.text("DROP TABLE dag_run"))
conn.execute(sa.text("ALTER TABLE dag_run_new RENAME TO dag_run"))
conn.execute(sa.text("PRAGMA foreign_keys=on"))
Review Comment:
Just found `disable_sqlite_fkeys` utils as context manger for `PRAGMA
foreign_keys=off / on`, should we replace the manual call with the
`disable_sqlite_fkeys` context manger?
( Though it seems `disable_sqlite_fkeys` also need a small fix, as it miss
the `sa.text()` wrapper with the literal. )
--
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]