Skip to content

Commit a028836

Browse files
authored
Fix: Cast to TEXT in state sync instead of using custom text types (#1681)
1 parent dfcf1a4 commit a028836

File tree

2 files changed

+17
-25
lines changed

2 files changed

+17
-25
lines changed

sqlmesh/core/state_sync/engine_adapter.py

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
from sqlmesh.utils import major_minor, random_id
5858
from sqlmesh.utils.date import TimeLike, now_timestamp, time_like_to_str
5959
from sqlmesh.utils.errors import SQLMeshError
60-
from sqlmesh.utils.migration import blob_text_type, index_text_type
6160

6261
logger = logging.getLogger(__name__)
6362

@@ -104,20 +103,17 @@ def __init__(
104103
self.plan_dags_table = exp.table_("_plan_dags", db=self.schema)
105104
self.versions_table = exp.table_("_versions", db=self.schema)
106105

107-
index_type = index_text_type(self.engine_adapter.dialect)
108-
blob_type = blob_text_type(self.engine_adapter.dialect)
109-
110106
self._snapshot_columns_to_types = {
111-
"name": exp.DataType.build(index_type),
112-
"identifier": exp.DataType.build(index_type),
113-
"version": exp.DataType.build(index_type),
114-
"snapshot": exp.DataType.build(blob_type),
115-
"kind_name": exp.DataType.build(index_type),
107+
"name": exp.DataType.build("text"),
108+
"identifier": exp.DataType.build("text"),
109+
"version": exp.DataType.build("text"),
110+
"snapshot": exp.DataType.build("text"),
111+
"kind_name": exp.DataType.build("text"),
116112
}
117113

118114
self._environment_columns_to_types = {
119-
"name": exp.DataType.build(index_type),
120-
"snapshots": exp.DataType.build(blob_type),
115+
"name": exp.DataType.build("text"),
116+
"snapshots": exp.DataType.build("text"),
121117
"start_at": exp.DataType.build("text"),
122118
"end_at": exp.DataType.build("text"),
123119
"plan_id": exp.DataType.build("text"),
@@ -129,17 +125,17 @@ def __init__(
129125
}
130126

131127
self._seed_columns_to_types = {
132-
"name": exp.DataType.build(index_type),
133-
"identifier": exp.DataType.build(index_type),
134-
"content": exp.DataType.build(blob_type),
128+
"name": exp.DataType.build("text"),
129+
"identifier": exp.DataType.build("text"),
130+
"content": exp.DataType.build("text"),
135131
}
136132

137133
self._interval_columns_to_types = {
138-
"id": exp.DataType.build(index_type),
134+
"id": exp.DataType.build("text"),
139135
"created_ts": exp.DataType.build("bigint"),
140-
"name": exp.DataType.build(index_type),
141-
"identifier": exp.DataType.build(index_type),
142-
"version": exp.DataType.build(index_type),
136+
"name": exp.DataType.build("text"),
137+
"identifier": exp.DataType.build("text"),
138+
"version": exp.DataType.build("text"),
143139
"start_ts": exp.DataType.build("bigint"),
144140
"end_ts": exp.DataType.build("bigint"),
145141
"is_dev": exp.DataType.build("boolean"),

sqlmesh/schedulers/airflow/plan.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from sqlmesh.schedulers.airflow import common
1616
from sqlmesh.utils.date import now, now_timestamp
1717
from sqlmesh.utils.errors import SQLMeshError
18-
from sqlmesh.utils.migration import blob_text_type, index_text_type
1918

2019

2120
class PlanDagState:
@@ -24,13 +23,10 @@ def __init__(self, engine_adapter: EngineAdapter, plan_dags_table: exp.Table):
2423

2524
self._plan_dags_table = plan_dags_table
2625

27-
index_type = index_text_type(self.engine_adapter.dialect)
28-
blob_type = blob_text_type(self.engine_adapter.dialect)
29-
3026
self._plan_dag_columns_to_types = {
31-
"request_id": exp.DataType.build(index_type),
32-
"dag_id": exp.DataType.build(index_type),
33-
"dag_spec": exp.DataType.build(blob_type),
27+
"request_id": exp.DataType.build("text"),
28+
"dag_id": exp.DataType.build("text"),
29+
"dag_spec": exp.DataType.build("text"),
3430
}
3531

3632
@classmethod

0 commit comments

Comments
 (0)