sqlmesh 0.217.1.dev1__py3-none-any.whl → 0.227.2.dev4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sqlmesh/__init__.py +12 -2
- sqlmesh/_version.py +2 -2
- sqlmesh/cli/project_init.py +10 -2
- sqlmesh/core/_typing.py +1 -0
- sqlmesh/core/audit/definition.py +8 -2
- sqlmesh/core/config/__init__.py +1 -1
- sqlmesh/core/config/connection.py +17 -5
- sqlmesh/core/config/dbt.py +13 -0
- sqlmesh/core/config/janitor.py +12 -0
- sqlmesh/core/config/loader.py +7 -0
- sqlmesh/core/config/model.py +2 -0
- sqlmesh/core/config/root.py +3 -0
- sqlmesh/core/console.py +80 -2
- sqlmesh/core/constants.py +1 -1
- sqlmesh/core/context.py +61 -25
- sqlmesh/core/dialect.py +3 -0
- sqlmesh/core/engine_adapter/_typing.py +2 -0
- sqlmesh/core/engine_adapter/base.py +322 -22
- sqlmesh/core/engine_adapter/base_postgres.py +17 -1
- sqlmesh/core/engine_adapter/bigquery.py +146 -7
- sqlmesh/core/engine_adapter/clickhouse.py +17 -13
- sqlmesh/core/engine_adapter/databricks.py +33 -2
- sqlmesh/core/engine_adapter/fabric.py +1 -29
- sqlmesh/core/engine_adapter/mixins.py +142 -48
- sqlmesh/core/engine_adapter/mssql.py +15 -4
- sqlmesh/core/engine_adapter/mysql.py +2 -2
- sqlmesh/core/engine_adapter/postgres.py +9 -3
- sqlmesh/core/engine_adapter/redshift.py +4 -0
- sqlmesh/core/engine_adapter/risingwave.py +1 -0
- sqlmesh/core/engine_adapter/shared.py +6 -0
- sqlmesh/core/engine_adapter/snowflake.py +82 -11
- sqlmesh/core/engine_adapter/spark.py +14 -10
- sqlmesh/core/engine_adapter/trino.py +4 -2
- sqlmesh/core/janitor.py +181 -0
- sqlmesh/core/lineage.py +1 -0
- sqlmesh/core/macros.py +35 -13
- sqlmesh/core/model/common.py +2 -0
- sqlmesh/core/model/definition.py +65 -4
- sqlmesh/core/model/kind.py +66 -2
- sqlmesh/core/model/meta.py +107 -2
- sqlmesh/core/node.py +101 -2
- sqlmesh/core/plan/builder.py +15 -10
- sqlmesh/core/plan/common.py +196 -2
- sqlmesh/core/plan/definition.py +21 -6
- sqlmesh/core/plan/evaluator.py +72 -113
- sqlmesh/core/plan/explainer.py +90 -8
- sqlmesh/core/plan/stages.py +42 -21
- sqlmesh/core/renderer.py +26 -18
- sqlmesh/core/scheduler.py +60 -19
- sqlmesh/core/selector.py +137 -9
- sqlmesh/core/signal.py +64 -1
- sqlmesh/core/snapshot/__init__.py +1 -0
- sqlmesh/core/snapshot/definition.py +109 -25
- sqlmesh/core/snapshot/evaluator.py +610 -50
- sqlmesh/core/state_sync/__init__.py +0 -1
- sqlmesh/core/state_sync/base.py +31 -27
- sqlmesh/core/state_sync/cache.py +12 -4
- sqlmesh/core/state_sync/common.py +216 -111
- sqlmesh/core/state_sync/db/facade.py +30 -15
- sqlmesh/core/state_sync/db/interval.py +27 -7
- sqlmesh/core/state_sync/db/migrator.py +14 -8
- sqlmesh/core/state_sync/db/snapshot.py +119 -87
- sqlmesh/core/table_diff.py +2 -2
- sqlmesh/core/test/definition.py +14 -9
- sqlmesh/dbt/adapter.py +20 -11
- sqlmesh/dbt/basemodel.py +52 -41
- sqlmesh/dbt/builtin.py +27 -11
- sqlmesh/dbt/column.py +17 -5
- sqlmesh/dbt/common.py +4 -2
- sqlmesh/dbt/context.py +14 -1
- sqlmesh/dbt/loader.py +60 -8
- sqlmesh/dbt/manifest.py +136 -8
- sqlmesh/dbt/model.py +105 -25
- sqlmesh/dbt/package.py +16 -1
- sqlmesh/dbt/profile.py +3 -3
- sqlmesh/dbt/project.py +12 -7
- sqlmesh/dbt/seed.py +1 -1
- sqlmesh/dbt/source.py +6 -1
- sqlmesh/dbt/target.py +25 -6
- sqlmesh/dbt/test.py +31 -1
- sqlmesh/migrations/v0000_baseline.py +3 -6
- sqlmesh/migrations/v0061_mysql_fix_blob_text_type.py +2 -5
- sqlmesh/migrations/v0062_add_model_gateway.py +2 -2
- sqlmesh/migrations/v0063_change_signals.py +2 -4
- sqlmesh/migrations/v0064_join_when_matched_strings.py +2 -4
- sqlmesh/migrations/v0065_add_model_optimize.py +2 -2
- sqlmesh/migrations/v0066_add_auto_restatements.py +2 -6
- sqlmesh/migrations/v0067_add_tsql_date_full_precision.py +2 -2
- sqlmesh/migrations/v0068_include_unrendered_query_in_metadata_hash.py +2 -2
- sqlmesh/migrations/v0069_update_dev_table_suffix.py +2 -4
- sqlmesh/migrations/v0070_include_grains_in_metadata_hash.py +2 -2
- sqlmesh/migrations/v0071_add_dev_version_to_intervals.py +2 -6
- sqlmesh/migrations/v0072_add_environment_statements.py +2 -4
- sqlmesh/migrations/v0073_remove_symbolic_disable_restatement.py +2 -4
- sqlmesh/migrations/v0074_add_partition_by_time_column_property.py +2 -2
- sqlmesh/migrations/v0075_remove_validate_query.py +2 -4
- sqlmesh/migrations/v0076_add_cron_tz.py +2 -2
- sqlmesh/migrations/v0077_fix_column_type_hash_calculation.py +2 -2
- sqlmesh/migrations/v0078_warn_if_non_migratable_python_env.py +2 -4
- sqlmesh/migrations/v0079_add_gateway_managed_property.py +7 -9
- sqlmesh/migrations/v0080_add_batch_size_to_scd_type_2_models.py +2 -2
- sqlmesh/migrations/v0081_update_partitioned_by.py +2 -4
- sqlmesh/migrations/v0082_warn_if_incorrectly_duplicated_statements.py +2 -4
- sqlmesh/migrations/v0083_use_sql_for_scd_time_data_type_data_hash.py +2 -2
- sqlmesh/migrations/v0084_normalize_quote_when_matched_and_merge_filter.py +2 -2
- sqlmesh/migrations/v0085_deterministic_repr.py +2 -4
- sqlmesh/migrations/v0086_check_deterministic_bug.py +2 -4
- sqlmesh/migrations/v0087_normalize_blueprint_variables.py +2 -4
- sqlmesh/migrations/v0088_warn_about_variable_python_env_diffs.py +2 -4
- sqlmesh/migrations/v0089_add_virtual_environment_mode.py +2 -2
- sqlmesh/migrations/v0090_add_forward_only_column.py +2 -6
- sqlmesh/migrations/v0091_on_additive_change.py +2 -2
- sqlmesh/migrations/v0092_warn_about_dbt_data_type_diff.py +2 -4
- sqlmesh/migrations/v0093_use_raw_sql_in_fingerprint.py +2 -2
- sqlmesh/migrations/v0094_add_dev_version_and_fingerprint_columns.py +2 -6
- sqlmesh/migrations/v0095_warn_about_dbt_raw_sql_diff.py +2 -4
- sqlmesh/migrations/v0096_remove_plan_dags_table.py +2 -4
- sqlmesh/migrations/v0097_add_dbt_name_in_node.py +2 -2
- sqlmesh/migrations/v0098_add_dbt_node_info_in_node.py +103 -0
- sqlmesh/migrations/v0099_add_last_altered_to_intervals.py +25 -0
- sqlmesh/migrations/v0100_add_grants_and_grants_target_layer.py +9 -0
- sqlmesh/utils/__init__.py +8 -1
- sqlmesh/utils/cache.py +5 -1
- sqlmesh/utils/date.py +1 -1
- sqlmesh/utils/errors.py +4 -0
- sqlmesh/utils/jinja.py +25 -2
- sqlmesh/utils/pydantic.py +6 -6
- sqlmesh/utils/windows.py +13 -3
- {sqlmesh-0.217.1.dev1.dist-info → sqlmesh-0.227.2.dev4.dist-info}/METADATA +5 -5
- {sqlmesh-0.217.1.dev1.dist-info → sqlmesh-0.227.2.dev4.dist-info}/RECORD +181 -176
- sqlmesh_dbt/cli.py +70 -7
- sqlmesh_dbt/console.py +14 -6
- sqlmesh_dbt/operations.py +103 -24
- sqlmesh_dbt/selectors.py +39 -1
- web/client/dist/assets/{Audits-Ucsx1GzF.js → Audits-CBiYyyx-.js} +1 -1
- web/client/dist/assets/{Banner-BWDzvavM.js → Banner-DSRbUlO5.js} +1 -1
- web/client/dist/assets/{ChevronDownIcon-D2VL13Ah.js → ChevronDownIcon-MK_nrjD_.js} +1 -1
- web/client/dist/assets/{ChevronRightIcon-DWGYbf1l.js → ChevronRightIcon-CLWtT22Q.js} +1 -1
- web/client/dist/assets/{Content-DdHDZM3I.js → Content-BNuGZN5l.js} +1 -1
- web/client/dist/assets/{Content-Bikfy8fh.js → Content-CSHJyW0n.js} +1 -1
- web/client/dist/assets/{Data-CzAJH7rW.js → Data-C1oRDbLx.js} +1 -1
- web/client/dist/assets/{DataCatalog-BJF11g8f.js → DataCatalog-HXyX2-_j.js} +1 -1
- web/client/dist/assets/{Editor-s0SBpV2y.js → Editor-BDyfpUuw.js} +1 -1
- web/client/dist/assets/{Editor-DgLhgKnm.js → Editor-D0jNItwC.js} +1 -1
- web/client/dist/assets/{Errors-D0m0O1d3.js → Errors-BfuFLcPi.js} +1 -1
- web/client/dist/assets/{FileExplorer-CEv0vXkt.js → FileExplorer-BR9IE3he.js} +1 -1
- web/client/dist/assets/{Footer-BwzXn8Ew.js → Footer-CgBEtiAh.js} +1 -1
- web/client/dist/assets/{Header-6heDkEqG.js → Header-DSqR6nSO.js} +1 -1
- web/client/dist/assets/{Input-obuJsD6k.js → Input-B-oZ6fGO.js} +1 -1
- web/client/dist/assets/Lineage-DYQVwDbD.js +1 -0
- web/client/dist/assets/{ListboxShow-HM9_qyrt.js → ListboxShow-BE5-xevs.js} +1 -1
- web/client/dist/assets/{ModelLineage-zWdKo0U2.js → ModelLineage-DkIFAYo4.js} +1 -1
- web/client/dist/assets/{Models-Bcu66SRz.js → Models-D5dWr8RB.js} +1 -1
- web/client/dist/assets/{Page-BWEEQfIt.js → Page-C-XfU5BR.js} +1 -1
- web/client/dist/assets/{Plan-C4gXCqlf.js → Plan-ZEuTINBq.js} +1 -1
- web/client/dist/assets/{PlusCircleIcon-CVDO651q.js → PlusCircleIcon-DVXAHG8_.js} +1 -1
- web/client/dist/assets/{ReportErrors-BT6xFwAr.js → ReportErrors-B7FEPzMB.js} +1 -1
- web/client/dist/assets/{Root-ryJoBK4h.js → Root-8aZyhPxF.js} +1 -1
- web/client/dist/assets/{SearchList-DB04sPb9.js → SearchList-W_iT2G82.js} +1 -1
- web/client/dist/assets/{SelectEnvironment-CUYcXUu6.js → SelectEnvironment-C65jALmO.js} +1 -1
- web/client/dist/assets/{SourceList-Doo_9ZGp.js → SourceList-DSLO6nVJ.js} +1 -1
- web/client/dist/assets/{SourceListItem-D5Mj7Dly.js → SourceListItem-BHt8d9-I.js} +1 -1
- web/client/dist/assets/{SplitPane-qHmkD1qy.js → SplitPane-CViaZmw6.js} +1 -1
- web/client/dist/assets/{Tests-DH1Z74ML.js → Tests-DhaVt5t1.js} +1 -1
- web/client/dist/assets/{Welcome-DqUJUNMF.js → Welcome-DvpjH-_4.js} +1 -1
- web/client/dist/assets/context-BctCsyGb.js +71 -0
- web/client/dist/assets/{context-Dr54UHLi.js → context-DFNeGsFF.js} +1 -1
- web/client/dist/assets/{editor-DYIP1yQ4.js → editor-CcO28cqd.js} +1 -1
- web/client/dist/assets/{file-DarlIDVi.js → file-CvJN3aZO.js} +1 -1
- web/client/dist/assets/{floating-ui.react-dom-BH3TFvkM.js → floating-ui.react-dom-CjE-JNW1.js} +1 -1
- web/client/dist/assets/{help-Bl8wqaQc.js → help-DuPhjipa.js} +1 -1
- web/client/dist/assets/{index-D1sR7wpN.js → index-C-dJH7yZ.js} +1 -1
- web/client/dist/assets/{index-O3mjYpnE.js → index-Dj0i1-CA.js} +2 -2
- web/client/dist/assets/{plan-CehRrJUG.js → plan-BTRSbjKn.js} +1 -1
- web/client/dist/assets/{popover-CqgMRE0G.js → popover-_Sf0yvOI.js} +1 -1
- web/client/dist/assets/{project-6gxepOhm.js → project-BvSOI8MY.js} +1 -1
- web/client/dist/index.html +1 -1
- web/client/dist/assets/Lineage-D0Hgdz2v.js +0 -1
- web/client/dist/assets/context-DgX0fp2E.js +0 -68
- {sqlmesh-0.217.1.dev1.dist-info → sqlmesh-0.227.2.dev4.dist-info}/WHEEL +0 -0
- {sqlmesh-0.217.1.dev1.dist-info → sqlmesh-0.227.2.dev4.dist-info}/entry_points.txt +0 -0
- {sqlmesh-0.217.1.dev1.dist-info → sqlmesh-0.227.2.dev4.dist-info}/licenses/LICENSE +0 -0
- {sqlmesh-0.217.1.dev1.dist-info → sqlmesh-0.227.2.dev4.dist-info}/top_level.txt +0 -0
sqlmesh/dbt/test.py
CHANGED
|
@@ -8,6 +8,7 @@ from pathlib import Path
|
|
|
8
8
|
from pydantic import Field
|
|
9
9
|
import sqlmesh.core.dialect as d
|
|
10
10
|
from sqlmesh.core.audit import Audit, ModelAudit, StandaloneAudit
|
|
11
|
+
from sqlmesh.core.node import DbtNodeInfo
|
|
11
12
|
from sqlmesh.dbt.common import (
|
|
12
13
|
Dependencies,
|
|
13
14
|
GeneralConfig,
|
|
@@ -79,8 +80,10 @@ class TestConfig(GeneralConfig):
|
|
|
79
80
|
dialect_: t.Optional[str] = Field(None, alias="dialect")
|
|
80
81
|
|
|
81
82
|
# dbt fields
|
|
83
|
+
unique_id: str = ""
|
|
82
84
|
package_name: str = ""
|
|
83
85
|
alias: t.Optional[str] = None
|
|
86
|
+
fqn: t.List[str] = []
|
|
84
87
|
schema_: t.Optional[str] = Field("", alias="schema")
|
|
85
88
|
database: t.Optional[str] = None
|
|
86
89
|
severity: Severity = Severity.ERROR
|
|
@@ -106,9 +109,28 @@ class TestConfig(GeneralConfig):
|
|
|
106
109
|
def _lowercase_name(cls, v: str) -> str:
|
|
107
110
|
return v.lower()
|
|
108
111
|
|
|
112
|
+
@property
|
|
113
|
+
def canonical_name(self) -> str:
|
|
114
|
+
return f"{self.package_name}.{self.name}".lower() if self.package_name else self.name
|
|
115
|
+
|
|
109
116
|
@property
|
|
110
117
|
def is_standalone(self) -> bool:
|
|
111
|
-
|
|
118
|
+
# A test is standalone if:
|
|
119
|
+
# 1. It has no model_name (already standalone), OR
|
|
120
|
+
# 2. It references other models besides its own model
|
|
121
|
+
if not self.model_name:
|
|
122
|
+
return True
|
|
123
|
+
|
|
124
|
+
# Check if test has references to other models
|
|
125
|
+
# For versioned models, refs include version (e.g., "model_name_v1") but model_name may not
|
|
126
|
+
self_refs = {self.model_name}
|
|
127
|
+
for ref in self.dependencies.refs:
|
|
128
|
+
# versioned models end in _vX
|
|
129
|
+
if ref.startswith(f"{self.model_name}_v"):
|
|
130
|
+
self_refs.add(ref)
|
|
131
|
+
|
|
132
|
+
other_refs = {ref for ref in self.dependencies.refs if ref not in self_refs}
|
|
133
|
+
return bool(other_refs)
|
|
112
134
|
|
|
113
135
|
@property
|
|
114
136
|
def sqlmesh_config_fields(self) -> t.Set[str]:
|
|
@@ -147,6 +169,7 @@ class TestConfig(GeneralConfig):
|
|
|
147
169
|
jinja_macros.add_globals({"this": self.relation_info})
|
|
148
170
|
audit = StandaloneAudit(
|
|
149
171
|
name=self.name,
|
|
172
|
+
dbt_node_info=self.node_info,
|
|
150
173
|
dialect=self.dialect(context),
|
|
151
174
|
skip=skip,
|
|
152
175
|
query=query,
|
|
@@ -163,6 +186,7 @@ class TestConfig(GeneralConfig):
|
|
|
163
186
|
else:
|
|
164
187
|
audit = ModelAudit(
|
|
165
188
|
name=self.name,
|
|
189
|
+
dbt_node_info=self.node_info,
|
|
166
190
|
dialect=self.dialect(context),
|
|
167
191
|
skip=skip,
|
|
168
192
|
blocking=blocking,
|
|
@@ -206,6 +230,12 @@ class TestConfig(GeneralConfig):
|
|
|
206
230
|
}
|
|
207
231
|
)
|
|
208
232
|
|
|
233
|
+
@property
|
|
234
|
+
def node_info(self) -> DbtNodeInfo:
|
|
235
|
+
return DbtNodeInfo(
|
|
236
|
+
unique_id=self.unique_id, name=self.name, fqn=".".join(self.fqn), alias=self.alias
|
|
237
|
+
)
|
|
238
|
+
|
|
209
239
|
|
|
210
240
|
def _remove_jinja_braces(jinja_str: str) -> str:
|
|
211
241
|
no_braces = jinja_str
|
|
@@ -4,15 +4,12 @@ from sqlglot import exp
|
|
|
4
4
|
from sqlmesh.utils.migration import blob_text_type, index_text_type
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
def migrate_schemas(
|
|
8
|
-
schema = state_sync.schema
|
|
9
|
-
engine_adapter = state_sync.engine_adapter
|
|
10
|
-
|
|
7
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
11
8
|
intervals_table = "_intervals"
|
|
12
9
|
snapshots_table = "_snapshots"
|
|
13
10
|
environments_table = "_environments"
|
|
14
11
|
versions_table = "_versions"
|
|
15
|
-
if
|
|
12
|
+
if schema:
|
|
16
13
|
engine_adapter.create_schema(schema)
|
|
17
14
|
intervals_table = f"{schema}.{intervals_table}"
|
|
18
15
|
snapshots_table = f"{schema}.{snapshots_table}"
|
|
@@ -94,5 +91,5 @@ def migrate_schemas(state_sync, **kwargs): # type: ignore
|
|
|
94
91
|
engine_adapter.create_index(intervals_table, "_intervals_name_version_idx", ("name", "version"))
|
|
95
92
|
|
|
96
93
|
|
|
97
|
-
def migrate_rows(
|
|
94
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
98
95
|
pass
|
|
@@ -9,12 +9,9 @@ from sqlglot import exp
|
|
|
9
9
|
from sqlmesh.utils.migration import blob_text_type
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
def migrate_schemas(
|
|
13
|
-
engine_adapter = state_sync.engine_adapter
|
|
12
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
14
13
|
if engine_adapter.dialect != "mysql":
|
|
15
14
|
return
|
|
16
|
-
|
|
17
|
-
schema = state_sync.schema
|
|
18
15
|
environments_table = "_environments"
|
|
19
16
|
snapshots_table = "_snapshots"
|
|
20
17
|
|
|
@@ -46,5 +43,5 @@ def migrate_schemas(state_sync, **kwargs): # type: ignore
|
|
|
46
43
|
engine_adapter.execute(alter_table_exp)
|
|
47
44
|
|
|
48
45
|
|
|
49
|
-
def migrate_rows(
|
|
46
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
50
47
|
pass
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"""Add the gateway model attribute."""
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
def migrate_schemas(
|
|
4
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
5
5
|
pass
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def migrate_rows(
|
|
8
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
9
9
|
pass
|
|
@@ -7,15 +7,13 @@ from sqlglot import exp, parse_one
|
|
|
7
7
|
from sqlmesh.utils.migration import index_text_type, blob_text_type
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
def migrate_schemas(
|
|
10
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
11
11
|
pass
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
def migrate_rows(
|
|
14
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
15
15
|
import pandas as pd
|
|
16
16
|
|
|
17
|
-
engine_adapter = state_sync.engine_adapter
|
|
18
|
-
schema = state_sync.schema
|
|
19
17
|
snapshots_table = "_snapshots"
|
|
20
18
|
index_type = index_text_type(engine_adapter.dialect)
|
|
21
19
|
if schema:
|
|
@@ -7,15 +7,13 @@ from sqlglot import exp
|
|
|
7
7
|
from sqlmesh.utils.migration import index_text_type, blob_text_type
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
def migrate_schemas(
|
|
10
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
11
11
|
pass
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
def migrate_rows(
|
|
14
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
15
15
|
import pandas as pd
|
|
16
16
|
|
|
17
|
-
engine_adapter = state_sync.engine_adapter
|
|
18
|
-
schema = state_sync.schema
|
|
19
17
|
snapshots_table = "_snapshots"
|
|
20
18
|
index_type = index_text_type(engine_adapter.dialect)
|
|
21
19
|
if schema:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"""Add the optimize_query model attribute."""
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
def migrate_schemas(
|
|
4
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
5
5
|
pass
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def migrate_rows(
|
|
8
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
9
9
|
pass
|
|
@@ -5,9 +5,7 @@ from sqlglot import exp
|
|
|
5
5
|
from sqlmesh.utils.migration import index_text_type
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def migrate_schemas(
|
|
9
|
-
engine_adapter = state_sync.engine_adapter
|
|
10
|
-
schema = state_sync.schema
|
|
8
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
11
9
|
auto_restatements_table = "_auto_restatements"
|
|
12
10
|
intervals_table = "_intervals"
|
|
13
11
|
|
|
@@ -40,9 +38,7 @@ def migrate_schemas(state_sync, **kwargs): # type: ignore
|
|
|
40
38
|
engine_adapter.execute(alter_table_exp)
|
|
41
39
|
|
|
42
40
|
|
|
43
|
-
def migrate_rows(
|
|
44
|
-
engine_adapter = state_sync.engine_adapter
|
|
45
|
-
schema = state_sync.schema
|
|
41
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
46
42
|
intervals_table = "_intervals"
|
|
47
43
|
|
|
48
44
|
if schema:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"""Add full precision for tsql to support nanoseconds."""
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
def migrate_schemas(
|
|
4
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
5
5
|
pass
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def migrate_rows(
|
|
8
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
9
9
|
pass
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"""Include the unrendered query in the metadata hash."""
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
def migrate_schemas(
|
|
4
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
5
5
|
pass
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def migrate_rows(
|
|
8
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
9
9
|
pass
|
|
@@ -7,15 +7,13 @@ from sqlglot import exp
|
|
|
7
7
|
from sqlmesh.utils.migration import index_text_type, blob_text_type
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
def migrate_schemas(
|
|
10
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
11
11
|
pass
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
def migrate_rows(
|
|
14
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
15
15
|
import pandas as pd
|
|
16
16
|
|
|
17
|
-
engine_adapter = state_sync.engine_adapter
|
|
18
|
-
schema = state_sync.schema
|
|
19
17
|
snapshots_table = "_snapshots"
|
|
20
18
|
environments_table = "_environments"
|
|
21
19
|
if schema:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"""Include grains in the metadata hash."""
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
def migrate_schemas(
|
|
4
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
5
5
|
pass
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def migrate_rows(
|
|
8
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
9
9
|
pass
|
|
@@ -8,9 +8,7 @@ from sqlglot import exp
|
|
|
8
8
|
from sqlmesh.utils.migration import index_text_type, blob_text_type
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
def migrate_schemas(
|
|
12
|
-
engine_adapter = state_sync.engine_adapter
|
|
13
|
-
schema = state_sync.schema
|
|
11
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
14
12
|
intervals_table = "_intervals"
|
|
15
13
|
if schema:
|
|
16
14
|
intervals_table = f"{schema}.{intervals_table}"
|
|
@@ -29,9 +27,7 @@ def migrate_schemas(state_sync, **kwargs): # type: ignore
|
|
|
29
27
|
engine_adapter.execute(alter_table_exp)
|
|
30
28
|
|
|
31
29
|
|
|
32
|
-
def migrate_rows(
|
|
33
|
-
engine_adapter = state_sync.engine_adapter
|
|
34
|
-
schema = state_sync.schema
|
|
30
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
35
31
|
intervals_table = "_intervals"
|
|
36
32
|
snapshots_table = "_snapshots"
|
|
37
33
|
if schema:
|
|
@@ -5,9 +5,7 @@ from sqlglot import exp
|
|
|
5
5
|
from sqlmesh.utils.migration import blob_text_type, index_text_type
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def migrate_schemas(
|
|
9
|
-
engine_adapter = state_sync.engine_adapter
|
|
10
|
-
schema = state_sync.schema
|
|
8
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
11
9
|
environment_statements_table = "_environment_statements"
|
|
12
10
|
|
|
13
11
|
if schema:
|
|
@@ -27,5 +25,5 @@ def migrate_schemas(state_sync, **kwargs): # type: ignore
|
|
|
27
25
|
)
|
|
28
26
|
|
|
29
27
|
|
|
30
|
-
def migrate_rows(
|
|
28
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
31
29
|
pass
|
|
@@ -6,15 +6,13 @@ from sqlglot import exp
|
|
|
6
6
|
from sqlmesh.utils.migration import index_text_type, blob_text_type
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
def migrate_schemas(
|
|
9
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
10
10
|
pass
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
def migrate_rows(
|
|
13
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
14
14
|
import pandas as pd
|
|
15
15
|
|
|
16
|
-
engine_adapter = state_sync.engine_adapter
|
|
17
|
-
schema = state_sync.schema
|
|
18
16
|
snapshots_table = "_snapshots"
|
|
19
17
|
if schema:
|
|
20
18
|
snapshots_table = f"{schema}.{snapshots_table}"
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
(default: True to keep the original behaviour)"""
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
def migrate_schemas(
|
|
5
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
6
6
|
pass
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
def migrate_rows(
|
|
9
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
10
10
|
pass
|
|
@@ -8,15 +8,13 @@ from sqlmesh.utils.migration import index_text_type
|
|
|
8
8
|
from sqlmesh.utils.migration import blob_text_type
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
def migrate_schemas(
|
|
11
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
12
12
|
pass
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
def migrate_rows(
|
|
15
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
16
16
|
import pandas as pd
|
|
17
17
|
|
|
18
|
-
engine_adapter = state_sync.engine_adapter
|
|
19
|
-
schema = state_sync.schema
|
|
20
18
|
snapshots_table = "_snapshots"
|
|
21
19
|
index_type = index_text_type(engine_adapter.dialect)
|
|
22
20
|
if schema:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"""Add 'cron_tz' property to node definition."""
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
def migrate_schemas(
|
|
4
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
5
5
|
pass
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def migrate_rows(
|
|
8
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
9
9
|
pass
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"""Use the model's dialect when calculating the hash for the column types."""
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
def migrate_schemas(
|
|
4
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
5
5
|
pass
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def migrate_rows(
|
|
8
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
9
9
|
pass
|
|
@@ -24,13 +24,11 @@ import sqlmesh.core.dialect as d
|
|
|
24
24
|
from sqlmesh.core.console import get_console
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
def migrate_schemas(
|
|
27
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
28
28
|
pass
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
def migrate_rows(
|
|
32
|
-
engine_adapter = state_sync.engine_adapter
|
|
33
|
-
schema = state_sync.schema
|
|
31
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
34
32
|
snapshots_table = "_snapshots"
|
|
35
33
|
if schema:
|
|
36
34
|
snapshots_table = f"{schema}.{snapshots_table}"
|
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
from sqlglot import exp
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
def migrate_schemas(
|
|
7
|
-
engine_adapter = state_sync.engine_adapter
|
|
6
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
8
7
|
environments_table = "_environments"
|
|
9
|
-
if
|
|
10
|
-
environments_table = f"{
|
|
8
|
+
if schema:
|
|
9
|
+
environments_table = f"{schema}.{environments_table}"
|
|
11
10
|
|
|
12
11
|
alter_table_exp = exp.Alter(
|
|
13
12
|
this=exp.to_table(environments_table),
|
|
@@ -22,13 +21,12 @@ def migrate_schemas(state_sync, **kwargs): # type: ignore
|
|
|
22
21
|
engine_adapter.execute(alter_table_exp)
|
|
23
22
|
|
|
24
23
|
|
|
25
|
-
def migrate_rows(
|
|
26
|
-
engine_adapter = state_sync.engine_adapter
|
|
24
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
27
25
|
environments_table = "_environments"
|
|
28
|
-
if
|
|
29
|
-
environments_table = f"{
|
|
26
|
+
if schema:
|
|
27
|
+
environments_table = f"{schema}.{environments_table}"
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
engine_adapter.update_table(
|
|
32
30
|
environments_table,
|
|
33
31
|
{"gateway_managed": False},
|
|
34
32
|
where=exp.true(),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"""Add batch_size to SCD Type 2 models and add updated_at_name to by time which changes their data hash."""
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
def migrate_schemas(
|
|
4
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
5
5
|
pass
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def migrate_rows(
|
|
8
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
9
9
|
pass
|
|
@@ -8,15 +8,13 @@ from sqlmesh.utils.migration import index_text_type
|
|
|
8
8
|
from sqlmesh.utils.migration import blob_text_type
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
def migrate_schemas(
|
|
11
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
12
12
|
pass
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
def migrate_rows(
|
|
15
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
16
16
|
import pandas as pd
|
|
17
17
|
|
|
18
|
-
engine_adapter = state_sync.engine_adapter
|
|
19
|
-
schema = state_sync.schema
|
|
20
18
|
snapshots_table = "_snapshots"
|
|
21
19
|
index_type = index_text_type(engine_adapter.dialect)
|
|
22
20
|
if schema:
|
|
@@ -34,13 +34,11 @@ from sqlglot import exp
|
|
|
34
34
|
from sqlmesh.core.console import get_console
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
def migrate_schemas(
|
|
37
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
38
38
|
pass
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
def migrate_rows(
|
|
42
|
-
engine_adapter = state_sync.engine_adapter
|
|
43
|
-
schema = state_sync.schema
|
|
41
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
44
42
|
snapshots_table = "_snapshots"
|
|
45
43
|
if schema:
|
|
46
44
|
snapshots_table = f"{schema}.{snapshots_table}"
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"""Use sql(...) instead of gen when computing the data hash of the time data type."""
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
def migrate_schemas(
|
|
4
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
5
5
|
pass
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def migrate_rows(
|
|
8
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
9
9
|
pass
|
|
@@ -5,9 +5,9 @@ prevent un-normalized identifiers being quoted at the EngineAdapter level
|
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def migrate_schemas(
|
|
8
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
9
9
|
pass
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
def migrate_rows(
|
|
12
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
13
13
|
pass
|
|
@@ -36,15 +36,13 @@ def _dict_sort(obj: t.Any) -> str:
|
|
|
36
36
|
return repr(obj)
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
def migrate_schemas(
|
|
39
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
40
40
|
pass
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
def migrate_rows(
|
|
43
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
44
44
|
import pandas as pd
|
|
45
45
|
|
|
46
|
-
engine_adapter = state_sync.engine_adapter
|
|
47
|
-
schema = state_sync.schema
|
|
48
46
|
snapshots_table = "_snapshots"
|
|
49
47
|
if schema:
|
|
50
48
|
snapshots_table = f"{schema}.{snapshots_table}"
|
|
@@ -10,13 +10,11 @@ logger = logging.getLogger(__name__)
|
|
|
10
10
|
KEYS_TO_MAKE_DETERMINISTIC = ["__sqlmesh__vars__", "__sqlmesh__blueprint__vars__"]
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
def migrate_schemas(
|
|
13
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
14
14
|
pass
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
def migrate_rows(
|
|
18
|
-
engine_adapter = state_sync.engine_adapter
|
|
19
|
-
schema = state_sync.schema
|
|
17
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
20
18
|
snapshots_table = "_snapshots"
|
|
21
19
|
versions_table = "_versions"
|
|
22
20
|
if schema:
|
|
@@ -35,15 +35,13 @@ class SqlValue:
|
|
|
35
35
|
sql: str
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
def migrate_schemas(
|
|
38
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
39
39
|
pass
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
def migrate_rows(
|
|
42
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
43
43
|
import pandas as pd
|
|
44
44
|
|
|
45
|
-
engine_adapter = state_sync.engine_adapter
|
|
46
|
-
schema = state_sync.schema
|
|
47
45
|
snapshots_table = "_snapshots"
|
|
48
46
|
if schema:
|
|
49
47
|
snapshots_table = f"{schema}.{snapshots_table}"
|
|
@@ -35,13 +35,11 @@ SQLMESH_BLUEPRINT_VARS = "__sqlmesh__blueprint__vars__"
|
|
|
35
35
|
METADATA_HASH_EXPRESSIONS = {"on_virtual_update", "audits", "signals", "audit_definitions"}
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
def migrate_schemas(
|
|
38
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
39
39
|
pass
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
def migrate_rows(
|
|
43
|
-
engine_adapter = state_sync.engine_adapter
|
|
44
|
-
schema = state_sync.schema
|
|
42
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
45
43
|
snapshots_table = "_snapshots"
|
|
46
44
|
if schema:
|
|
47
45
|
snapshots_table = f"{schema}.{snapshots_table}"
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"""Add virtual_environment_mode to the model definition."""
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
def migrate_schemas(
|
|
4
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
5
5
|
pass
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def migrate_rows(
|
|
8
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
9
9
|
pass
|
|
@@ -7,9 +7,7 @@ from sqlglot import exp
|
|
|
7
7
|
from sqlmesh.utils.migration import index_text_type, blob_text_type
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
def migrate_schemas(
|
|
11
|
-
engine_adapter = state_sync.engine_adapter
|
|
12
|
-
schema = state_sync.schema
|
|
10
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
13
11
|
snapshots_table = "_snapshots"
|
|
14
12
|
if schema:
|
|
15
13
|
snapshots_table = f"{schema}.{snapshots_table}"
|
|
@@ -27,11 +25,9 @@ def migrate_schemas(state_sync, **kwargs): # type: ignore
|
|
|
27
25
|
engine_adapter.execute(alter_table_exp)
|
|
28
26
|
|
|
29
27
|
|
|
30
|
-
def migrate_rows(
|
|
28
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
31
29
|
import pandas as pd
|
|
32
30
|
|
|
33
|
-
engine_adapter = state_sync.engine_adapter
|
|
34
|
-
schema = state_sync.schema
|
|
35
31
|
snapshots_table = "_snapshots"
|
|
36
32
|
if schema:
|
|
37
33
|
snapshots_table = f"{schema}.{snapshots_table}"
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"""Add on_additive_change to incremental model metadata hash."""
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
def migrate_schemas(
|
|
4
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
5
5
|
pass
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def migrate_rows(
|
|
8
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
9
9
|
pass
|
|
@@ -17,13 +17,11 @@ from sqlmesh.core.console import get_console
|
|
|
17
17
|
SQLMESH_DBT_PACKAGE = "sqlmesh.dbt"
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
def migrate_schemas(
|
|
20
|
+
def migrate_schemas(engine_adapter, schema, **kwargs): # type: ignore
|
|
21
21
|
pass
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
def migrate_rows(
|
|
25
|
-
engine_adapter = state_sync.engine_adapter
|
|
26
|
-
schema = state_sync.schema
|
|
24
|
+
def migrate_rows(engine_adapter, schema, **kwargs): # type: ignore
|
|
27
25
|
snapshots_table = "_snapshots"
|
|
28
26
|
if schema:
|
|
29
27
|
snapshots_table = f"{schema}.{snapshots_table}"
|