diff --git a/airflow/migrations/versions/0093_2_2_0_taskinstance_keyed_to_dagrun.py b/airflow/migrations/versions/0093_2_2_0_taskinstance_keyed_to_dagrun.py index 91bc59c164464b..85ad605e5304b8 100644 --- a/airflow/migrations/versions/0093_2_2_0_taskinstance_keyed_to_dagrun.py +++ b/airflow/migrations/versions/0093_2_2_0_taskinstance_keyed_to_dagrun.py @@ -225,8 +225,7 @@ def upgrade(): constraints = get_mssql_table_constraints(conn, "task_instance") pk, _ = constraints["PRIMARY KEY"].popitem() batch_op.drop_constraint(pk, type_="primary") - elif dialect_name not in ("sqlite"): - batch_op.drop_constraint("task_instance_pkey", type_="primary") + batch_op.drop_constraint("task_instance_pkey", type_="primary") batch_op.drop_index("ti_dag_date") batch_op.drop_index("ti_state_lkp") batch_op.drop_column("execution_date") @@ -402,7 +401,7 @@ def _multi_table_update(dialect_name, target, column): if dialect_name == "sqlite": # Most SQLite versions don't support multi table update (and SQLA doesn't know about it anyway), so we # need to do a Correlated subquery update - sub_q = select(dag_run.c[column.name]).where(condition) + sub_q = select(dag_run.c[column.name]).where(condition).scalar_subquery() return target.update().values({column: sub_q}) else: diff --git a/airflow/migrations/versions/0102_2_3_0_switch_xcom_table_to_use_run_id.py b/airflow/migrations/versions/0102_2_3_0_switch_xcom_table_to_use_run_id.py index 5ff67b23a7407f..1194a2077390e7 100644 --- a/airflow/migrations/versions/0102_2_3_0_switch_xcom_table_to_use_run_id.py +++ b/airflow/migrations/versions/0102_2_3_0_switch_xcom_table_to_use_run_id.py @@ -93,16 +93,14 @@ def upgrade(): xcom = Table("xcom", metadata, *_get_old_xcom_columns()) dagrun = _get_dagrun_table() query = select( - [ - dagrun.c.id, - xcom.c.task_id, - xcom.c.key, - xcom.c.value, - xcom.c.timestamp, - xcom.c.dag_id, - dagrun.c.run_id, - literal_column("-1"), - ], + dagrun.c.id, + xcom.c.task_id, + xcom.c.key, + xcom.c.value, + xcom.c.timestamp, + xcom.c.dag_id, + dagrun.c.run_id, + literal_column("-1"), ).select_from( xcom.join( right=dagrun, diff --git a/airflow/migrations/versions/0104_2_3_0_migrate_rtif_to_use_run_id_and_map_index.py b/airflow/migrations/versions/0104_2_3_0_migrate_rtif_to_use_run_id_and_map_index.py index f11f57c5548a57..9d1b3999836416 100644 --- a/airflow/migrations/versions/0104_2_3_0_migrate_rtif_to_use_run_id_and_map_index.py +++ b/airflow/migrations/versions/0104_2_3_0_migrate_rtif_to_use_run_id_and_map_index.py @@ -100,7 +100,7 @@ def _multi_table_update(dialect_name, target, column): if dialect_name == "sqlite": # Most SQLite versions don't support multi table update (and SQLA doesn't know about it anyway), so we # need to do a Correlated subquery update - sub_q = select(dag_run.c[column.name]).where(condition) + sub_q = select(dag_run.c[column.name]).where(condition).scalar_subquery() return target.update().values({column: sub_q}) else: diff --git a/airflow/migrations/versions/0105_2_3_0_add_map_index_to_taskfail.py b/airflow/migrations/versions/0105_2_3_0_add_map_index_to_taskfail.py index b6c41e83dcee52..06f6538dbe475d 100644 --- a/airflow/migrations/versions/0105_2_3_0_add_map_index_to_taskfail.py +++ b/airflow/migrations/versions/0105_2_3_0_add_map_index_to_taskfail.py @@ -96,7 +96,7 @@ def _update_value_from_dag_run( if dialect_name == "sqlite": # Most SQLite versions don't support multi table update (and SQLA doesn't know about it anyway), so we # need to do a Correlated subquery update - sub_q = select(dag_run.c[target_column.name]).where(condition) + sub_q = select(dag_run.c[target_column.name]).where(condition).scalar_subquery() return target_table.update().values({target_column: sub_q}) else: diff --git a/docs/apache-airflow/img/airflow_erd.sha256 b/docs/apache-airflow/img/airflow_erd.sha256 index 464463bb3f4b03..5e0ad21ed694fc 100644 --- a/docs/apache-airflow/img/airflow_erd.sha256 +++ b/docs/apache-airflow/img/airflow_erd.sha256 @@ -1 +1 @@ -45e8aa557ff6c5c69995915206df2fef17495d5da04453e897cea73a8df0f492 \ No newline at end of file +ec3c33d964d9afc51f0fbbee9bb2ef8c8dc496675a6ef96891a30d0403bb6823 \ No newline at end of file diff --git a/docs/apache-airflow/img/airflow_erd.svg b/docs/apache-airflow/img/airflow_erd.svg index 7225b0ce3ef152..019ff78714fa6e 100644 --- a/docs/apache-airflow/img/airflow_erd.svg +++ b/docs/apache-airflow/img/airflow_erd.svg @@ -1421,7 +1421,7 @@ task_instance--xcom -0..N +1 1 @@ -1435,7 +1435,7 @@ task_instance--xcom -1 +0..N 1