sqlmesh 0.186.2.dev6__py3-none-any.whl → 0.186.2.dev8__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/_version.py +2 -2
- sqlmesh/core/engine_adapter/bigquery.py +25 -1
- sqlmesh/core/model/common.py +0 -1
- sqlmesh/core/model/meta.py +38 -0
- sqlmesh/core/table_diff.py +22 -1
- {sqlmesh-0.186.2.dev6.dist-info → sqlmesh-0.186.2.dev8.dist-info}/METADATA +1 -1
- {sqlmesh-0.186.2.dev6.dist-info → sqlmesh-0.186.2.dev8.dist-info}/RECORD +11 -11
- {sqlmesh-0.186.2.dev6.dist-info → sqlmesh-0.186.2.dev8.dist-info}/WHEEL +0 -0
- {sqlmesh-0.186.2.dev6.dist-info → sqlmesh-0.186.2.dev8.dist-info}/entry_points.txt +0 -0
- {sqlmesh-0.186.2.dev6.dist-info → sqlmesh-0.186.2.dev8.dist-info}/licenses/LICENSE +0 -0
- {sqlmesh-0.186.2.dev6.dist-info → sqlmesh-0.186.2.dev8.dist-info}/top_level.txt +0 -0
sqlmesh/_version.py
CHANGED
|
@@ -17,5 +17,5 @@ __version__: str
|
|
|
17
17
|
__version_tuple__: VERSION_TUPLE
|
|
18
18
|
version_tuple: VERSION_TUPLE
|
|
19
19
|
|
|
20
|
-
__version__ = version = '0.186.2.
|
|
21
|
-
__version_tuple__ = version_tuple = (0, 186, 2, '
|
|
20
|
+
__version__ = version = '0.186.2.dev8'
|
|
21
|
+
__version_tuple__ = version_tuple = (0, 186, 2, 'dev8')
|
|
@@ -183,7 +183,31 @@ class BigQueryEngineAdapter(InsertOverwriteWithMergeMixin, ClusteredByMixin, Row
|
|
|
183
183
|
def _begin_session(self, properties: SessionProperties) -> None:
|
|
184
184
|
from google.cloud.bigquery import QueryJobConfig
|
|
185
185
|
|
|
186
|
-
|
|
186
|
+
query_label_property = properties.get("query_label")
|
|
187
|
+
parsed_query_label: list[tuple[str, str]] = []
|
|
188
|
+
if isinstance(query_label_property, (exp.Array, exp.Paren, exp.Tuple)):
|
|
189
|
+
label_tuples = (
|
|
190
|
+
[query_label_property.unnest()]
|
|
191
|
+
if isinstance(query_label_property, exp.Paren)
|
|
192
|
+
else query_label_property.expressions
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
# query_label is a Paren, Array or Tuple of 2-tuples and validated at load time
|
|
196
|
+
parsed_query_label.extend(
|
|
197
|
+
(label_tuple.expressions[0].name, label_tuple.expressions[1].name)
|
|
198
|
+
for label_tuple in label_tuples
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
if parsed_query_label:
|
|
202
|
+
query_label_str = ",".join([":".join(label) for label in parsed_query_label])
|
|
203
|
+
query = f'SET @@query_label = "{query_label_str}";SELECT 1;'
|
|
204
|
+
else:
|
|
205
|
+
query = "SELECT 1;"
|
|
206
|
+
|
|
207
|
+
job = self.client.query(
|
|
208
|
+
query,
|
|
209
|
+
job_config=QueryJobConfig(create_session=True),
|
|
210
|
+
)
|
|
187
211
|
session_info = job.session_info
|
|
188
212
|
session_id = session_info.session_id if session_info else None
|
|
189
213
|
self._session_id = session_id
|
sqlmesh/core/model/common.py
CHANGED
|
@@ -441,7 +441,6 @@ bool_validator: t.Callable = field_validator(
|
|
|
441
441
|
properties_validator: t.Callable = field_validator(
|
|
442
442
|
"physical_properties_",
|
|
443
443
|
"virtual_properties_",
|
|
444
|
-
"session_properties_",
|
|
445
444
|
"materialization_properties_",
|
|
446
445
|
mode="before",
|
|
447
446
|
check_fields=False,
|
sqlmesh/core/model/meta.py
CHANGED
|
@@ -17,6 +17,7 @@ from sqlmesh.core.model.common import (
|
|
|
17
17
|
default_catalog_validator,
|
|
18
18
|
depends_on_validator,
|
|
19
19
|
properties_validator,
|
|
20
|
+
parse_properties,
|
|
20
21
|
)
|
|
21
22
|
from sqlmesh.core.model.kind import (
|
|
22
23
|
CustomKind,
|
|
@@ -310,6 +311,43 @@ class ModelMeta(_Node):
|
|
|
310
311
|
def ignored_rules_validator(cls, vs: t.Any) -> t.Any:
|
|
311
312
|
return LinterConfig._validate_rules(vs)
|
|
312
313
|
|
|
314
|
+
@field_validator("session_properties_", mode="before")
|
|
315
|
+
def session_properties_validator(cls, v: t.Any, info: ValidationInfo) -> t.Any:
|
|
316
|
+
# use the generic properties validator to parse the session properties
|
|
317
|
+
parsed_session_properties = parse_properties(type(cls), v, info)
|
|
318
|
+
if not parsed_session_properties:
|
|
319
|
+
return parsed_session_properties
|
|
320
|
+
|
|
321
|
+
for eq in parsed_session_properties:
|
|
322
|
+
if eq.name == "query_label":
|
|
323
|
+
query_label = eq.right
|
|
324
|
+
if not (
|
|
325
|
+
isinstance(query_label, exp.Array)
|
|
326
|
+
or isinstance(query_label, exp.Tuple)
|
|
327
|
+
or isinstance(query_label, exp.Paren)
|
|
328
|
+
):
|
|
329
|
+
raise ConfigError(
|
|
330
|
+
"Invalid value for `session_properties.query_label`. Must be an array or tuple."
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
label_tuples: t.List[exp.Expression] = (
|
|
334
|
+
[query_label.unnest()]
|
|
335
|
+
if isinstance(query_label, exp.Paren)
|
|
336
|
+
else query_label.expressions
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
for label_tuple in label_tuples:
|
|
340
|
+
if not (
|
|
341
|
+
isinstance(label_tuple, exp.Tuple)
|
|
342
|
+
and len(label_tuple.expressions) == 2
|
|
343
|
+
and all(isinstance(label, exp.Literal) for label in label_tuple.expressions)
|
|
344
|
+
):
|
|
345
|
+
raise ConfigError(
|
|
346
|
+
"Invalid entry in `session_properties.query_label`. Must be tuples of string literals with length 2."
|
|
347
|
+
)
|
|
348
|
+
|
|
349
|
+
return parsed_session_properties
|
|
350
|
+
|
|
313
351
|
@model_validator(mode="before")
|
|
314
352
|
def _pre_root_validator(cls, data: t.Any) -> t.Any:
|
|
315
353
|
if not isinstance(data, dict):
|
sqlmesh/core/table_diff.py
CHANGED
|
@@ -8,6 +8,7 @@ import pandas as pd
|
|
|
8
8
|
|
|
9
9
|
from sqlmesh.core.dialect import to_schema
|
|
10
10
|
from sqlmesh.core.engine_adapter.mixins import RowDiffMixin
|
|
11
|
+
from sqlmesh.core.engine_adapter.athena import AthenaEngineAdapter
|
|
11
12
|
from sqlglot import exp, parse_one
|
|
12
13
|
from sqlglot.helper import ensure_list
|
|
13
14
|
from sqlglot.optimizer.normalize_identifiers import normalize_identifiers
|
|
@@ -15,6 +16,7 @@ from sqlglot.optimizer.qualify_columns import quote_identifiers
|
|
|
15
16
|
from sqlglot.optimizer.scope import find_all_in_scope
|
|
16
17
|
|
|
17
18
|
from sqlmesh.utils.pydantic import PydanticModel
|
|
19
|
+
from sqlmesh.utils.errors import SQLMeshError
|
|
18
20
|
|
|
19
21
|
if t.TYPE_CHECKING:
|
|
20
22
|
from sqlmesh.core._typing import TableName
|
|
@@ -431,7 +433,26 @@ class TableDiff:
|
|
|
431
433
|
schema = to_schema(temp_schema, dialect=self.dialect)
|
|
432
434
|
temp_table = exp.table_("diff", db=schema.db, catalog=schema.catalog, quoted=True)
|
|
433
435
|
|
|
434
|
-
|
|
436
|
+
temp_table_kwargs = {}
|
|
437
|
+
if isinstance(self.adapter, AthenaEngineAdapter):
|
|
438
|
+
# Athena has two table formats: Hive (the default) and Iceberg. TableDiff requires that
|
|
439
|
+
# the formats be the same for the source, target, and temp tables.
|
|
440
|
+
source_table_type = self.adapter._query_table_type(self.source_table)
|
|
441
|
+
target_table_type = self.adapter._query_table_type(self.target_table)
|
|
442
|
+
|
|
443
|
+
if source_table_type == "iceberg" and target_table_type == "iceberg":
|
|
444
|
+
temp_table_kwargs["table_format"] = "iceberg"
|
|
445
|
+
# Sets the temp table's format to Iceberg.
|
|
446
|
+
# If neither source nor target table is Iceberg, it defaults to Hive (Athena's default).
|
|
447
|
+
elif source_table_type == "iceberg" or target_table_type == "iceberg":
|
|
448
|
+
raise SQLMeshError(
|
|
449
|
+
f"Source table '{self.source}' format '{source_table_type}' and target table '{self.target}' format '{target_table_type}' "
|
|
450
|
+
f"do not match for Athena. Diffing between different table formats is not supported."
|
|
451
|
+
)
|
|
452
|
+
|
|
453
|
+
with self.adapter.temp_table(
|
|
454
|
+
query, name=temp_table, columns_to_types=None, **temp_table_kwargs
|
|
455
|
+
) as table:
|
|
435
456
|
summary_sums = [
|
|
436
457
|
exp.func("SUM", "s_exists").as_("s_count"),
|
|
437
458
|
exp.func("SUM", "t_exists").as_("t_count"),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
sqlmesh/__init__.py,sha256=69xw6bTmi4cW90M-sl3g6wLDgxVcLHcKg1q8GS3lqyA,7466
|
|
2
|
-
sqlmesh/_version.py,sha256=
|
|
2
|
+
sqlmesh/_version.py,sha256=7dUqtNPvu4V-ZPmdhd1YOfRQYTcyCp3yKc8KacdEer0,528
|
|
3
3
|
sqlmesh/magics.py,sha256=JHorAZNtezf123jmTyNSoUC9yHmv-08hMP205PJmmIo,39750
|
|
4
4
|
sqlmesh/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
sqlmesh/cicd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -29,7 +29,7 @@ sqlmesh/core/schema_diff.py,sha256=mE28W51JUQz6q8inSOw2Cds84VPIqPxI6C2ed6xLmrg,2
|
|
|
29
29
|
sqlmesh/core/schema_loader.py,sha256=lvrI9k7hr1P4X4E6t3U-KrcuvdQuw0UdNlN90P2s52w,3563
|
|
30
30
|
sqlmesh/core/selector.py,sha256=9riBQ6gPySg546x0JaXXITw2eZgGe9iVKcynAUJ1mmw,12137
|
|
31
31
|
sqlmesh/core/signal.py,sha256=yVLXewYP6eH0vt-EwaIaI2WwHz6hWsVr-Kb2m4kP1FU,1353
|
|
32
|
-
sqlmesh/core/table_diff.py,sha256=
|
|
32
|
+
sqlmesh/core/table_diff.py,sha256=AbTbmbV5aP-rqa-LT4A1MRnm5K-jmDi2F3N5cz-pFXQ,24838
|
|
33
33
|
sqlmesh/core/user.py,sha256=EJ6R4R1iK67n80vBoCCsidF56IR7xEYqiCEO-nrVMso,1660
|
|
34
34
|
sqlmesh/core/analytics/__init__.py,sha256=ou3ZXAJfQOXEifj-PzaXwMDSvJzsVaqaMkUopiI00kM,3247
|
|
35
35
|
sqlmesh/core/analytics/collector.py,sha256=sggJvER16Jrg5triTC27E2KwaQvfkVDv4D6R1lVPH5I,13058
|
|
@@ -61,7 +61,7 @@ sqlmesh/core/engine_adapter/_typing.py,sha256=BAM_U7Vsi0k37XHu_nNnu3whXxuTVDey_u
|
|
|
61
61
|
sqlmesh/core/engine_adapter/athena.py,sha256=WBVAB_YzBJXdiqq51LTd2jmYoMtGrLmtsA8IrIFVnQ0,26199
|
|
62
62
|
sqlmesh/core/engine_adapter/base.py,sha256=WDyZhieFq9iBQSDsLdf-ae6aPu25d-FpwZ4Lt3FPf6o,101153
|
|
63
63
|
sqlmesh/core/engine_adapter/base_postgres.py,sha256=DOsOdCJyQAVfA9S0GznuH0J1bonMqYVP_yJLDYcxFYM,6772
|
|
64
|
-
sqlmesh/core/engine_adapter/bigquery.py,sha256=
|
|
64
|
+
sqlmesh/core/engine_adapter/bigquery.py,sha256=dc4ve_O5Tu6CKuojt5_edr4kAHUzR_HWIPFpsunat_w,50201
|
|
65
65
|
sqlmesh/core/engine_adapter/clickhouse.py,sha256=4ACsYsZ8-gvyCozwoEMEayTTUdMjmNea4xUkxtXw6R4,34907
|
|
66
66
|
sqlmesh/core/engine_adapter/databricks.py,sha256=AbNbnt9nQdOd7lTov2zsKROZlzgV2fLvOYXam3cowvk,14507
|
|
67
67
|
sqlmesh/core/engine_adapter/duckdb.py,sha256=FfNmBzLySDDi--nTlsSavTwdperCzhpYzDoroCilPcA,4900
|
|
@@ -85,11 +85,11 @@ sqlmesh/core/metric/definition.py,sha256=Yd5aVgsZCDPJ43aGP7WqtzZOuuSUtB8uJGVA6Jw
|
|
|
85
85
|
sqlmesh/core/metric/rewriter.py,sha256=GiSTHfn2kinqCfNPYgZPRk93JFLzVaaejHtHDQ0yXZI,7326
|
|
86
86
|
sqlmesh/core/model/__init__.py,sha256=C8GRZ53xuXEA9hQv3BQS9pNNyd9rZ06R_B96UYGhDu4,1644
|
|
87
87
|
sqlmesh/core/model/cache.py,sha256=s-aEFuUmUKITaWHvYbOyRarsjsgoA6vfASK-f-MwJ9k,7257
|
|
88
|
-
sqlmesh/core/model/common.py,sha256=
|
|
88
|
+
sqlmesh/core/model/common.py,sha256=vbcXFhWE22-FeKYAVIlKWvTb-wkeC8XISjU_TIlak0c,16252
|
|
89
89
|
sqlmesh/core/model/decorator.py,sha256=v_sVudNROGrtj5cZ3vgcOFnwPdzwoUGY6REAkQpIMQc,8927
|
|
90
90
|
sqlmesh/core/model/definition.py,sha256=QBwGNL7Jqg8BGgpZfTtKciRJA7axkI5FShJJjnUDQ4w,108645
|
|
91
91
|
sqlmesh/core/model/kind.py,sha256=i6_AMBarXPGPoMdF9kzBkyqS9tu__a2339-BoX7TgCM,36010
|
|
92
|
-
sqlmesh/core/model/meta.py,sha256=
|
|
92
|
+
sqlmesh/core/model/meta.py,sha256=osJgfSj6maIIdWAHzDVCkXXL--__gnKvqkzxM6Nuq6g,20779
|
|
93
93
|
sqlmesh/core/model/schema.py,sha256=QzM1cOfukuK3L-cEE9MtxKeYec3x5JvutdZAnczJSiQ,3858
|
|
94
94
|
sqlmesh/core/model/seed.py,sha256=ctUHH6CmeEnBVJyIAZznx0xJBm09W7VIZ-76Cfwfq28,5004
|
|
95
95
|
sqlmesh/core/plan/__init__.py,sha256=ctpnu9mK3uTujs0It8qRMqcj9GdObXDnvSgn4rD2zqc,450
|
|
@@ -269,7 +269,7 @@ sqlmesh/utils/pydantic.py,sha256=I898jAFqa3qU6lG2uPpRebVFncOUo8ZrLWM_R3K3DHU,116
|
|
|
269
269
|
sqlmesh/utils/rich.py,sha256=xNZyPCqEc4TAlJlsEthg-5eYUWpaizz0QjBzO7a1Yv4,1509
|
|
270
270
|
sqlmesh/utils/windows.py,sha256=r7Yin4WEwbvH7sKA3hOJtRsclmscNuBeCklCfVPvtQs,611
|
|
271
271
|
sqlmesh/utils/yaml.py,sha256=np-WVcwmwsKghCgAj1OBBMsK1SXSRn4wR-H37cGiFr8,2282
|
|
272
|
-
sqlmesh-0.186.2.
|
|
272
|
+
sqlmesh-0.186.2.dev8.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
|
|
273
273
|
web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
274
274
|
web/client/dist/index.html,sha256=M50OuwjW63dRCS0Dz40Yecgvw9ecLFqizbTa6gv5Nd4,5472
|
|
275
275
|
web/client/dist/assets/Audits-BPlxzqeG.js,sha256=TCx1qCjCGgmUSvH6HoPr5t8ztbRXMlOxrcW4o7hRjlA,1041
|
|
@@ -387,8 +387,8 @@ web/server/api/endpoints/models.py,sha256=ud-lRwriyI_OYg9tZchrBgeiXELiRTLNEodraf
|
|
|
387
387
|
web/server/api/endpoints/modules.py,sha256=8hqqgonGay_mJmpCw0IdbjsPhWlQH2VLdKAqha-myac,468
|
|
388
388
|
web/server/api/endpoints/plan.py,sha256=OYuQ_4dgbhG9ibTcX1a8mvYgH3ANxw9Fhbb4wg6QWqc,9222
|
|
389
389
|
web/server/api/endpoints/table_diff.py,sha256=Wd5YxeKbZB7AkrDvqFgvV9ZQlnKYOF1n5W_w2EHE_Zw,2085
|
|
390
|
-
sqlmesh-0.186.2.
|
|
391
|
-
sqlmesh-0.186.2.
|
|
392
|
-
sqlmesh-0.186.2.
|
|
393
|
-
sqlmesh-0.186.2.
|
|
394
|
-
sqlmesh-0.186.2.
|
|
390
|
+
sqlmesh-0.186.2.dev8.dist-info/METADATA,sha256=Id6FkMes83pYNUiaF8nOZ0VtUnLsPr5i4tbwZFCjTRg,25523
|
|
391
|
+
sqlmesh-0.186.2.dev8.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
|
392
|
+
sqlmesh-0.186.2.dev8.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
|
|
393
|
+
sqlmesh-0.186.2.dev8.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
|
|
394
|
+
sqlmesh-0.186.2.dev8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|