Skip to content

Commit 928ad38

Browse files
committed
PR feedback
1 parent 6906303 commit 928ad38

1 file changed

Lines changed: 0 additions & 40 deletions

File tree

sqlmesh/migrations/v0078_detect_diff_caused_py_metadata_flag_propagation_and_warn.py

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import typing as t
1818
import zlib
1919

20-
import pandas as pd
2120
from dataclasses import dataclass
2221
from enum import Enum
2322
from jinja2 import Environment, nodes
@@ -27,8 +26,6 @@
2726
import sqlmesh.core.dialect as d
2827
from sqlmesh.core.console import get_console
2928
from sqlmesh.utils import unique
30-
from sqlmesh.utils.migration import index_text_type
31-
from sqlmesh.utils.migration import blob_text_type
3229
from sqlmesh.utils.pydantic import PydanticModel
3330

3431
GATEWAY = "gateway"
@@ -41,12 +38,9 @@ def migrate(state_sync, **kwargs): # type: ignore
4138
engine_adapter = state_sync.engine_adapter
4239
schema = state_sync.schema
4340
snapshots_table = "_snapshots"
44-
index_type = index_text_type(engine_adapter.dialect)
4541
if schema:
4642
snapshots_table = f"{schema}.{snapshots_table}"
4743

48-
new_snapshots = []
49-
5044
for (
5145
name,
5246
identifier,
@@ -146,40 +140,6 @@ def migrate(state_sync, **kwargs): # type: ignore
146140
except Exception:
147141
pass
148142

149-
new_snapshots.append(
150-
{
151-
"name": name,
152-
"identifier": identifier,
153-
"version": version,
154-
"snapshot": json.dumps(parsed_snapshot),
155-
"kind_name": kind_name,
156-
"updated_ts": updated_ts,
157-
"unpaused_ts": unpaused_ts,
158-
"ttl_ms": ttl_ms,
159-
"unrestorable": unrestorable,
160-
}
161-
)
162-
163-
if new_snapshots:
164-
engine_adapter.delete_from(snapshots_table, "TRUE")
165-
blob_type = blob_text_type(engine_adapter.dialect)
166-
167-
engine_adapter.insert_append(
168-
snapshots_table,
169-
pd.DataFrame(new_snapshots),
170-
columns_to_types={
171-
"name": exp.DataType.build(index_type),
172-
"identifier": exp.DataType.build(index_type),
173-
"version": exp.DataType.build(index_type),
174-
"snapshot": exp.DataType.build(blob_type),
175-
"kind_name": exp.DataType.build(index_type),
176-
"updated_ts": exp.DataType.build("bigint"),
177-
"unpaused_ts": exp.DataType.build("bigint"),
178-
"ttl_ms": exp.DataType.build("bigint"),
179-
"unrestorable": exp.DataType.build("boolean"),
180-
},
181-
)
182-
183143

184144
def environment(**kwargs):
185145
extensions = kwargs.pop("extensions", [])

0 commit comments

Comments
 (0)