sqlmesh 0.189.3.dev25__py3-none-any.whl → 0.189.3.dev27__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/model/common.py +23 -2
- sqlmesh/core/model/definition.py +5 -2
- sqlmesh/core/model/kind.py +3 -1
- {sqlmesh-0.189.3.dev25.dist-info → sqlmesh-0.189.3.dev27.dist-info}/METADATA +1 -1
- {sqlmesh-0.189.3.dev25.dist-info → sqlmesh-0.189.3.dev27.dist-info}/RECORD +10 -10
- {sqlmesh-0.189.3.dev25.dist-info → sqlmesh-0.189.3.dev27.dist-info}/WHEEL +0 -0
- {sqlmesh-0.189.3.dev25.dist-info → sqlmesh-0.189.3.dev27.dist-info}/entry_points.txt +0 -0
- {sqlmesh-0.189.3.dev25.dist-info → sqlmesh-0.189.3.dev27.dist-info}/licenses/LICENSE +0 -0
- {sqlmesh-0.189.3.dev25.dist-info → sqlmesh-0.189.3.dev27.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.189.3.
|
|
21
|
-
__version_tuple__ = version_tuple = (0, 189, 3, '
|
|
20
|
+
__version__ = version = '0.189.3.dev27'
|
|
21
|
+
__version_tuple__ = version_tuple = (0, 189, 3, 'dev27')
|
sqlmesh/core/model/common.py
CHANGED
|
@@ -5,6 +5,7 @@ import typing as t
|
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
|
|
7
7
|
from astor import to_source
|
|
8
|
+
from difflib import get_close_matches
|
|
8
9
|
from sqlglot import exp
|
|
9
10
|
from sqlglot.helper import ensure_list
|
|
10
11
|
|
|
@@ -267,13 +268,33 @@ def validate_extra_and_required_fields(
|
|
|
267
268
|
) -> None:
|
|
268
269
|
missing_required_fields = klass.missing_required_fields(provided_fields)
|
|
269
270
|
if missing_required_fields:
|
|
271
|
+
field_names = "'" + "', '".join(missing_required_fields) + "'"
|
|
270
272
|
raise_config_error(
|
|
271
|
-
f"
|
|
273
|
+
f"Please add required field{'s' if len(missing_required_fields) > 1 else ''} {field_names} to the {entity_name}."
|
|
272
274
|
)
|
|
273
275
|
|
|
274
276
|
extra_fields = klass.extra_fields(provided_fields)
|
|
275
277
|
if extra_fields:
|
|
276
|
-
|
|
278
|
+
extra_field_names = "'" + "', '".join(extra_fields) + "'"
|
|
279
|
+
|
|
280
|
+
all_fields = klass.all_fields()
|
|
281
|
+
close_matches = {}
|
|
282
|
+
for field in extra_fields:
|
|
283
|
+
matches = get_close_matches(field, all_fields, n=1)
|
|
284
|
+
if matches:
|
|
285
|
+
close_matches[field] = matches[0]
|
|
286
|
+
|
|
287
|
+
if len(close_matches) == 1:
|
|
288
|
+
similar_msg = ". Did you mean " + "'" + "', '".join(close_matches.values()) + "'?"
|
|
289
|
+
else:
|
|
290
|
+
similar = [
|
|
291
|
+
f"- {field}: Did you mean '{match}'?" for field, match in close_matches.items()
|
|
292
|
+
]
|
|
293
|
+
similar_msg = "\n\n " + "\n ".join(similar) if similar else ""
|
|
294
|
+
|
|
295
|
+
raise_config_error(
|
|
296
|
+
f"Invalid field name{'s' if len(extra_fields) > 1 else ''} present in the {entity_name}: {extra_field_names}{similar_msg}"
|
|
297
|
+
)
|
|
277
298
|
|
|
278
299
|
|
|
279
300
|
def single_value_or_tuple(values: t.Sequence) -> exp.Identifier | exp.Tuple:
|
sqlmesh/core/model/definition.py
CHANGED
|
@@ -2156,7 +2156,10 @@ Learn more at https://sqlmesh.readthedocs.io/en/stable/concepts/models/overview
|
|
|
2156
2156
|
name = get_model_name(path)
|
|
2157
2157
|
|
|
2158
2158
|
if not name:
|
|
2159
|
-
raise_config_error(
|
|
2159
|
+
raise_config_error(
|
|
2160
|
+
"Please add the required 'name' field to the MODEL block at the top of the file.\n\n"
|
|
2161
|
+
+ "Learn more at https://sqlmesh.readthedocs.io/en/stable/concepts/models/overview"
|
|
2162
|
+
)
|
|
2160
2163
|
if "default_catalog" in meta_fields:
|
|
2161
2164
|
raise_config_error(
|
|
2162
2165
|
"`default_catalog` cannot be set on a per-model basis. It must be set at the connection level.",
|
|
@@ -2400,7 +2403,7 @@ def _create_model(
|
|
|
2400
2403
|
**kwargs: t.Any,
|
|
2401
2404
|
) -> Model:
|
|
2402
2405
|
validate_extra_and_required_fields(
|
|
2403
|
-
klass, {"name", *kwargs} - {"grain", "table_properties"}, "
|
|
2406
|
+
klass, {"name", *kwargs} - {"grain", "table_properties"}, "MODEL block"
|
|
2404
2407
|
)
|
|
2405
2408
|
|
|
2406
2409
|
for prop in PROPERTIES:
|
sqlmesh/core/model/kind.py
CHANGED
|
@@ -1015,7 +1015,9 @@ def create_model_kind(v: t.Any, dialect: str, defaults: t.Dict[str, t.Any]) -> M
|
|
|
1015
1015
|
actual_kind_type, _ = custom_materialization
|
|
1016
1016
|
return actual_kind_type(**props)
|
|
1017
1017
|
|
|
1018
|
-
validate_extra_and_required_fields(
|
|
1018
|
+
validate_extra_and_required_fields(
|
|
1019
|
+
kind_type, set(props), f"MODEL block 'kind {name}' field"
|
|
1020
|
+
)
|
|
1019
1021
|
return kind_type(**props)
|
|
1020
1022
|
|
|
1021
1023
|
name = (v.name if isinstance(v, exp.Expression) else str(v)).upper()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
sqlmesh/__init__.py,sha256=QjwaamJIdW7voXoS880yAx7tHm-Im4_mqGA-XJgafos,7631
|
|
2
|
-
sqlmesh/_version.py,sha256=
|
|
2
|
+
sqlmesh/_version.py,sha256=LcirdGaX5bDs5VXGEXX7ACdgaxQZgywpX0NUCnnli44,530
|
|
3
3
|
sqlmesh/magics.py,sha256=gjzoxREb1XT8Yho_PQMlMqhhkLq_sEfBM8S3PTgxvWE,40337
|
|
4
4
|
sqlmesh/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
sqlmesh/cicd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -86,10 +86,10 @@ sqlmesh/core/metric/definition.py,sha256=Yd5aVgsZCDPJ43aGP7WqtzZOuuSUtB8uJGVA6Jw
|
|
|
86
86
|
sqlmesh/core/metric/rewriter.py,sha256=GiSTHfn2kinqCfNPYgZPRk93JFLzVaaejHtHDQ0yXZI,7326
|
|
87
87
|
sqlmesh/core/model/__init__.py,sha256=C8GRZ53xuXEA9hQv3BQS9pNNyd9rZ06R_B96UYGhDu4,1644
|
|
88
88
|
sqlmesh/core/model/cache.py,sha256=csun0RJguHzKX6-qITcOs4fVP4f8_Ts8qiUVV4sHY6Q,7869
|
|
89
|
-
sqlmesh/core/model/common.py,sha256
|
|
89
|
+
sqlmesh/core/model/common.py,sha256=-AC57zytc-AGtSpk6lDcnpw-7g0FXV6aW8OfiyTqcBM,17151
|
|
90
90
|
sqlmesh/core/model/decorator.py,sha256=v_sVudNROGrtj5cZ3vgcOFnwPdzwoUGY6REAkQpIMQc,8927
|
|
91
|
-
sqlmesh/core/model/definition.py,sha256=
|
|
92
|
-
sqlmesh/core/model/kind.py,sha256=
|
|
91
|
+
sqlmesh/core/model/definition.py,sha256=052_23d3oAfzk62DPzjfyhHkwqUtf_ZY5Hm03u7pV5U,108638
|
|
92
|
+
sqlmesh/core/model/kind.py,sha256=ZyjfGuXO5pSGJfAZC91-RR4Kc2mwL6g3LO0tgew9Ldk,36044
|
|
93
93
|
sqlmesh/core/model/meta.py,sha256=D9InI9M2-IXeb34vkXNQSLALL8xVXjZ_LXwI-Tqxm7I,21197
|
|
94
94
|
sqlmesh/core/model/schema.py,sha256=OClbAeA8LpW-IiSiLT_TlDWkEqmIIvSk0GXq8SWI-GQ,3443
|
|
95
95
|
sqlmesh/core/model/seed.py,sha256=a0M-1zY1gOkN5ph2GQyataEdBSCtq50YjeFk2LyvInI,5058
|
|
@@ -275,7 +275,7 @@ sqlmesh/utils/pydantic.py,sha256=I898jAFqa3qU6lG2uPpRebVFncOUo8ZrLWM_R3K3DHU,116
|
|
|
275
275
|
sqlmesh/utils/rich.py,sha256=xNZyPCqEc4TAlJlsEthg-5eYUWpaizz0QjBzO7a1Yv4,1509
|
|
276
276
|
sqlmesh/utils/windows.py,sha256=r7Yin4WEwbvH7sKA3hOJtRsclmscNuBeCklCfVPvtQs,611
|
|
277
277
|
sqlmesh/utils/yaml.py,sha256=np-WVcwmwsKghCgAj1OBBMsK1SXSRn4wR-H37cGiFr8,2282
|
|
278
|
-
sqlmesh-0.189.3.
|
|
278
|
+
sqlmesh-0.189.3.dev27.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
|
|
279
279
|
web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
280
280
|
web/client/dist/index.html,sha256=k5bAEoPDJ0BhYQ4hBcKWObITCxIgqOUC28nGXvEDrt0,5472
|
|
281
281
|
web/client/dist/assets/Audits-Pgs8N6IE.js,sha256=BQuc9kiznZSqTnzNrJSDNqAAdOTGjNQJt32M1sHZFok,1041
|
|
@@ -393,8 +393,8 @@ web/server/api/endpoints/models.py,sha256=ud-lRwriyI_OYg9tZchrBgeiXELiRTLNEodraf
|
|
|
393
393
|
web/server/api/endpoints/modules.py,sha256=8hqqgonGay_mJmpCw0IdbjsPhWlQH2VLdKAqha-myac,468
|
|
394
394
|
web/server/api/endpoints/plan.py,sha256=OYuQ_4dgbhG9ibTcX1a8mvYgH3ANxw9Fhbb4wg6QWqc,9222
|
|
395
395
|
web/server/api/endpoints/table_diff.py,sha256=SCy3-pr5x6bEEiOaZGCDbiHQhpgxwmnz3Acqa2Ie6jI,2090
|
|
396
|
-
sqlmesh-0.189.3.
|
|
397
|
-
sqlmesh-0.189.3.
|
|
398
|
-
sqlmesh-0.189.3.
|
|
399
|
-
sqlmesh-0.189.3.
|
|
400
|
-
sqlmesh-0.189.3.
|
|
396
|
+
sqlmesh-0.189.3.dev27.dist-info/METADATA,sha256=rnNqIhdLYGKLOcd7U_ICFyg4JK09WZs3cGBW3eDzqsY,26541
|
|
397
|
+
sqlmesh-0.189.3.dev27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
398
|
+
sqlmesh-0.189.3.dev27.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
|
|
399
|
+
sqlmesh-0.189.3.dev27.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
|
|
400
|
+
sqlmesh-0.189.3.dev27.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|