From ff0067136b4f277f25897cadb00e9fbcd43783c8 Mon Sep 17 00:00:00 2001 From: Ryan Hatter <25823361+RNHTTR@users.noreply.github.com> Date: Thu, 29 Feb 2024 11:00:57 -0500 Subject: [PATCH 1/3] Allow longer rendered_map_index 64 is pretty small, and dag_id and task_id are both 250 per the [ERD](https://airflow.apache.org/docs/apache-airflow/stable/database-erd-ref.html) --- airflow/models/taskinstance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airflow/models/taskinstance.py b/airflow/models/taskinstance.py index fa0367fb13858..163c372976161 100644 --- a/airflow/models/taskinstance.py +++ b/airflow/models/taskinstance.py @@ -1253,7 +1253,7 @@ class TaskInstance(Base, LoggingMixin): pid = Column(Integer) executor_config = Column(ExecutorConfigType(pickler=dill)) updated_at = Column(UtcDateTime, default=timezone.utcnow, onupdate=timezone.utcnow) - rendered_map_index = Column(String(64)) + rendered_map_index = Column(String(250)) external_executor_id = Column(StringID()) From a43254f3c9ce9d020826b994b34597eae25cc608 Mon Sep 17 00:00:00 2001 From: Ryan Hatter Date: Thu, 29 Feb 2024 12:58:53 -0500 Subject: [PATCH 2/3] update rendered_map_index_length in migrations --- .../0134_2_9_0_add_rendered_map_index_to_taskinstance.py | 4 +++- docs/apache-airflow/img/airflow_erd.sha256 | 2 +- docs/apache-airflow/img/airflow_erd.svg | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/airflow/migrations/versions/0134_2_9_0_add_rendered_map_index_to_taskinstance.py b/airflow/migrations/versions/0134_2_9_0_add_rendered_map_index_to_taskinstance.py index 1aae15198783d..f127259b7bcc7 100644 --- a/airflow/migrations/versions/0134_2_9_0_add_rendered_map_index_to_taskinstance.py +++ b/airflow/migrations/versions/0134_2_9_0_add_rendered_map_index_to_taskinstance.py @@ -27,6 +27,8 @@ import sqlalchemy as sa from alembic import op +from airflow.models.base import StringID + # revision identifiers, used by Alembic. revision = "1fd565369930" @@ -41,7 +43,7 @@ def upgrade(): conn = op.get_bind() with op.batch_alter_table("task_instance") as batch_op: - batch_op.add_column(sa.Column("rendered_map_index", sa.String(length=64), nullable=True)) + batch_op.add_column(sa.Column("rendered_map_index", sa.String(length=StringID()), nullable=True)) def downgrade(): diff --git a/docs/apache-airflow/img/airflow_erd.sha256 b/docs/apache-airflow/img/airflow_erd.sha256 index 139e0665ed22c..d6ac8b0a0b19d 100644 --- a/docs/apache-airflow/img/airflow_erd.sha256 +++ b/docs/apache-airflow/img/airflow_erd.sha256 @@ -1 +1 @@ -798cc78efa225287635e12ec3cebc6025bbb4d8e0b629fb7a17f4c7f168bfc65 \ No newline at end of file +f2bd8914351a007e778e775a28510dd66e81db940e9b799db39ef6a5786f7d66 \ 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 4bbe208640d2f..33868c44ba25e 100644 --- a/docs/apache-airflow/img/airflow_erd.svg +++ b/docs/apache-airflow/img/airflow_erd.svg @@ -1031,7 +1031,7 @@ [TIMESTAMP] rendered_map_index - [VARCHAR(64)] + [VARCHAR(250)] start_date [TIMESTAMP] From 3b1c4e2402044e9c45b7cfe49138a0eca2c26a75 Mon Sep 17 00:00:00 2001 From: Ryan Hatter Date: Thu, 29 Feb 2024 13:54:47 -0500 Subject: [PATCH 3/3] revert StringID to hardcoded 250 --- .../0134_2_9_0_add_rendered_map_index_to_taskinstance.py | 4 +--- docs/apache-airflow/img/airflow_erd.sha256 | 2 +- docs/apache-airflow/img/airflow_erd.svg | 8 ++++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/airflow/migrations/versions/0134_2_9_0_add_rendered_map_index_to_taskinstance.py b/airflow/migrations/versions/0134_2_9_0_add_rendered_map_index_to_taskinstance.py index f127259b7bcc7..a7327c9e91d46 100644 --- a/airflow/migrations/versions/0134_2_9_0_add_rendered_map_index_to_taskinstance.py +++ b/airflow/migrations/versions/0134_2_9_0_add_rendered_map_index_to_taskinstance.py @@ -27,8 +27,6 @@ import sqlalchemy as sa from alembic import op -from airflow.models.base import StringID - # revision identifiers, used by Alembic. revision = "1fd565369930" @@ -43,7 +41,7 @@ def upgrade(): conn = op.get_bind() with op.batch_alter_table("task_instance") as batch_op: - batch_op.add_column(sa.Column("rendered_map_index", sa.String(length=StringID()), nullable=True)) + batch_op.add_column(sa.Column("rendered_map_index", sa.String(length=250), nullable=True)) def downgrade(): diff --git a/docs/apache-airflow/img/airflow_erd.sha256 b/docs/apache-airflow/img/airflow_erd.sha256 index d6ac8b0a0b19d..f7308c41ff041 100644 --- a/docs/apache-airflow/img/airflow_erd.sha256 +++ b/docs/apache-airflow/img/airflow_erd.sha256 @@ -1 +1 @@ -f2bd8914351a007e778e775a28510dd66e81db940e9b799db39ef6a5786f7d66 \ No newline at end of file +ed425ca6e30d06e1a1f64b9fd30043db7fb3e3a0196c57a77a4f1edc6a1d8ada \ 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 33868c44ba25e..04fef6f350012 100644 --- a/docs/apache-airflow/img/airflow_erd.svg +++ b/docs/apache-airflow/img/airflow_erd.svg @@ -1345,28 +1345,28 @@ task_instance--xcom -0..N +1 1 task_instance--xcom -1 +0..N 1 task_instance--xcom -1 +0..N 1 task_instance--xcom -0..N +1 1