sqlmesh 0.187.6.dev21__py3-none-any.whl → 0.187.6.dev23__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/config/root.py +2 -0
- sqlmesh/core/context.py +2 -2
- sqlmesh/core/context_diff.py +38 -18
- {sqlmesh-0.187.6.dev21.dist-info → sqlmesh-0.187.6.dev23.dist-info}/METADATA +1 -1
- {sqlmesh-0.187.6.dev21.dist-info → sqlmesh-0.187.6.dev23.dist-info}/RECORD +10 -10
- {sqlmesh-0.187.6.dev21.dist-info → sqlmesh-0.187.6.dev23.dist-info}/WHEEL +0 -0
- {sqlmesh-0.187.6.dev21.dist-info → sqlmesh-0.187.6.dev23.dist-info}/entry_points.txt +0 -0
- {sqlmesh-0.187.6.dev21.dist-info → sqlmesh-0.187.6.dev23.dist-info}/licenses/LICENSE +0 -0
- {sqlmesh-0.187.6.dev21.dist-info → sqlmesh-0.187.6.dev23.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.187.6.
|
|
21
|
-
__version_tuple__ = version_tuple = (0, 187, 6, '
|
|
20
|
+
__version__ = version = '0.187.6.dev23'
|
|
21
|
+
__version_tuple__ = version_tuple = (0, 187, 6, 'dev23')
|
sqlmesh/core/config/root.py
CHANGED
|
@@ -107,6 +107,7 @@ class Config(BaseConfig):
|
|
|
107
107
|
physical_schema_mapping: A mapping from regular expressions to names of schemas in which physical tables for corresponding models will be placed.
|
|
108
108
|
environment_suffix_target: Indicates whether to append the environment name to the schema or table name.
|
|
109
109
|
gateway_managed_virtual_layer: Whether the models' views in the virtual layer are created by the model-specific gateway rather than the default gateway.
|
|
110
|
+
infer_python_dependencies: Whether to statically analyze Python code to automatically infer Python package requirements.
|
|
110
111
|
environment_catalog_mapping: A mapping from regular expressions to catalog names. The catalog name is used to determine the target catalog for a given environment.
|
|
111
112
|
default_target_environment: The name of the environment that will be the default target for the `sqlmesh plan` and `sqlmesh run` commands.
|
|
112
113
|
log_limit: The default number of logs to keep.
|
|
@@ -146,6 +147,7 @@ class Config(BaseConfig):
|
|
|
146
147
|
default=EnvironmentSuffixTarget.default
|
|
147
148
|
)
|
|
148
149
|
gateway_managed_virtual_layer: bool = False
|
|
150
|
+
infer_python_dependencies: bool = True
|
|
149
151
|
environment_catalog_mapping: RegexKeyDict = {}
|
|
150
152
|
default_target_environment: str = c.PROD
|
|
151
153
|
log_limit: int = c.DEFAULT_LOG_LIMIT
|
sqlmesh/core/context.py
CHANGED
|
@@ -388,7 +388,6 @@ class GenericContext(BaseContext, t.Generic[C]):
|
|
|
388
388
|
self.pinned_environments = Environment.sanitize_names(self.config.pinned_environments)
|
|
389
389
|
self.auto_categorize_changes = self.config.plan.auto_categorize_changes
|
|
390
390
|
self.selected_gateway = gateway or self.config.default_gateway_name
|
|
391
|
-
self.gateway_managed_virtual_layer = self.config.gateway_managed_virtual_layer
|
|
392
391
|
|
|
393
392
|
gw_model_defaults = self.config.gateways[self.selected_gateway].model_defaults
|
|
394
393
|
if gw_model_defaults:
|
|
@@ -2617,7 +2616,8 @@ class GenericContext(BaseContext, t.Generic[C]):
|
|
|
2617
2616
|
ensure_finalized_snapshots=ensure_finalized_snapshots,
|
|
2618
2617
|
diff_rendered=diff_rendered,
|
|
2619
2618
|
environment_statements=self._environment_statements,
|
|
2620
|
-
gateway_managed_virtual_layer=self.gateway_managed_virtual_layer,
|
|
2619
|
+
gateway_managed_virtual_layer=self.config.gateway_managed_virtual_layer,
|
|
2620
|
+
infer_python_dependencies=self.config.infer_python_dependencies,
|
|
2621
2621
|
)
|
|
2622
2622
|
|
|
2623
2623
|
def _destroy(self) -> None:
|
sqlmesh/core/context_diff.py
CHANGED
|
@@ -102,6 +102,7 @@ class ContextDiff(PydanticModel):
|
|
|
102
102
|
diff_rendered: bool = False,
|
|
103
103
|
environment_statements: t.Optional[t.List[EnvironmentStatements]] = [],
|
|
104
104
|
gateway_managed_virtual_layer: bool = False,
|
|
105
|
+
infer_python_dependencies: bool = True,
|
|
105
106
|
) -> ContextDiff:
|
|
106
107
|
"""Create a ContextDiff object.
|
|
107
108
|
|
|
@@ -116,6 +117,12 @@ class ContextDiff(PydanticModel):
|
|
|
116
117
|
the environment is not finalized.
|
|
117
118
|
provided_requirements: Python dependencies sourced from the lock file.
|
|
118
119
|
excluded_requirements: Python dependencies to exclude.
|
|
120
|
+
diff_rendered: Whether to compute the diff of the rendered version of the compared expressions.
|
|
121
|
+
environment_statements: A list of `before_all` or `after_all` statements associated with the environment.
|
|
122
|
+
gateway_managed_virtual_layer: Whether the models' views in the virtual layer are created by the
|
|
123
|
+
model-specific gateway rather than the default gateway.
|
|
124
|
+
infer_python_dependencies: Whether to statically analyze Python code to automatically infer Python
|
|
125
|
+
package requirements.
|
|
119
126
|
|
|
120
127
|
Returns:
|
|
121
128
|
The ContextDiff object.
|
|
@@ -208,6 +215,7 @@ class ContextDiff(PydanticModel):
|
|
|
208
215
|
provided_requirements or {},
|
|
209
216
|
excluded_requirements or set(),
|
|
210
217
|
snapshots.values(),
|
|
218
|
+
infer_python_dependencies=infer_python_dependencies,
|
|
211
219
|
)
|
|
212
220
|
|
|
213
221
|
previous_environment_statements = state_reader.get_environment_statements(environment)
|
|
@@ -475,29 +483,41 @@ def _build_requirements(
|
|
|
475
483
|
provided_requirements: t.Dict[str, str],
|
|
476
484
|
excluded_requirements: t.Set[str],
|
|
477
485
|
snapshots: t.Collection[Snapshot],
|
|
486
|
+
infer_python_dependencies: bool = True,
|
|
478
487
|
) -> t.Dict[str, str]:
|
|
479
488
|
requirements = {
|
|
480
489
|
k: v for k, v in provided_requirements.items() if k not in excluded_requirements
|
|
481
490
|
}
|
|
491
|
+
|
|
492
|
+
if not infer_python_dependencies:
|
|
493
|
+
return requirements
|
|
494
|
+
|
|
482
495
|
distributions = metadata.packages_distributions()
|
|
483
496
|
|
|
484
497
|
for snapshot in snapshots:
|
|
485
|
-
if snapshot.is_model:
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
498
|
+
if not snapshot.is_model:
|
|
499
|
+
continue
|
|
500
|
+
|
|
501
|
+
for executable in snapshot.model.python_env.values():
|
|
502
|
+
if executable.kind != "import":
|
|
503
|
+
continue
|
|
504
|
+
|
|
505
|
+
try:
|
|
506
|
+
start = "from " if executable.payload.startswith("from ") else "import "
|
|
507
|
+
lib = executable.payload.split(start)[1].split()[0].split(".")[0]
|
|
508
|
+
if lib not in distributions:
|
|
509
|
+
continue
|
|
510
|
+
|
|
511
|
+
for dist in distributions[lib]:
|
|
512
|
+
if (
|
|
513
|
+
dist not in requirements
|
|
514
|
+
and dist not in IGNORED_PACKAGES
|
|
515
|
+
and dist not in excluded_requirements
|
|
516
|
+
):
|
|
517
|
+
requirements[dist] = metadata.version(dist)
|
|
518
|
+
except metadata.PackageNotFoundError:
|
|
519
|
+
from sqlmesh.core.console import get_console
|
|
520
|
+
|
|
521
|
+
get_console().log_warning(f"Failed to find package for {lib}.")
|
|
522
|
+
|
|
503
523
|
return requirements
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
sqlmesh/__init__.py,sha256=69xw6bTmi4cW90M-sl3g6wLDgxVcLHcKg1q8GS3lqyA,7466
|
|
2
|
-
sqlmesh/_version.py,sha256=
|
|
2
|
+
sqlmesh/_version.py,sha256=7YIMmCPDFoUaSNKpHvBvluuYOidZH1dvSoSBSUal0fw,530
|
|
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
|
|
@@ -13,8 +13,8 @@ sqlmesh/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
13
13
|
sqlmesh/core/_typing.py,sha256=e1f7xO2aZCy38M_3VoDy-XI3shyd99-IFctgIFSgXWM,497
|
|
14
14
|
sqlmesh/core/console.py,sha256=ZAaGLOWBJGBxPzLV7KZZ9akPExgD5m5AboCM8O0Q0nY,150944
|
|
15
15
|
sqlmesh/core/constants.py,sha256=oqt6zjepUhQoWlgapKn_HpG7Pu9mrFwepdX5caNfJUI,2499
|
|
16
|
-
sqlmesh/core/context.py,sha256=
|
|
17
|
-
sqlmesh/core/context_diff.py,sha256=
|
|
16
|
+
sqlmesh/core/context.py,sha256=NYCVq7yLfB6Owq2cfQcv1qUAcr7j87XT34J94sB8u70,116797
|
|
17
|
+
sqlmesh/core/context_diff.py,sha256=I7luvY2za30E5ynVaFPaEQQEmNViJpWAmW48PGSyDCU,21135
|
|
18
18
|
sqlmesh/core/dialect.py,sha256=fPTV517IOS0nWMxYznNNQnXkQkFFrPOSKe8ghsQ0o8A,49759
|
|
19
19
|
sqlmesh/core/environment.py,sha256=Fsih6WZ7Tx4ec0XIlmIIspUWcmijPNW5uHPRQSWuhA8,12315
|
|
20
20
|
sqlmesh/core/lineage.py,sha256=zjB0Zfamo2Fja2r5SSZPMbrEKTXr1WjozZPVqvxdybI,3143
|
|
@@ -52,7 +52,7 @@ sqlmesh/core/config/migration.py,sha256=3lZIlmIcQH3_hIEm3Y3jFtvpw0YXzRzAnk4Odikl
|
|
|
52
52
|
sqlmesh/core/config/model.py,sha256=GIz9kAfKD2NEXNzCZCQ17-CK2OtqN6WgeG1fvibcChM,3650
|
|
53
53
|
sqlmesh/core/config/naming.py,sha256=KVGaxUgswoQajXR_cHFJvgkmEFcU1V182GkOH1SJxuE,326
|
|
54
54
|
sqlmesh/core/config/plan.py,sha256=Sql_bdO2H_vVrIYosf8rWOTRVoMURciX7mEcbMNFFdg,1389
|
|
55
|
-
sqlmesh/core/config/root.py,sha256=
|
|
55
|
+
sqlmesh/core/config/root.py,sha256=Ytu5Evj4vtqouEIqQ4LkhZLc354P8qpOwrXkunTS6Tg,14907
|
|
56
56
|
sqlmesh/core/config/run.py,sha256=rIK0QnN_vArrwps2TXGVEbvao2AnGZgzXo7EliJa42E,852
|
|
57
57
|
sqlmesh/core/config/scheduler.py,sha256=k3BVMpy5ZrC05ZlyE3vec8ZGfTjUjWyfsKZtYgflbyA,7029
|
|
58
58
|
sqlmesh/core/config/ui.py,sha256=jsO-S6_d9NkLZGG5pT4mgKgxMF34KzkDociZAMvCX3U,278
|
|
@@ -270,7 +270,7 @@ sqlmesh/utils/pydantic.py,sha256=I898jAFqa3qU6lG2uPpRebVFncOUo8ZrLWM_R3K3DHU,116
|
|
|
270
270
|
sqlmesh/utils/rich.py,sha256=xNZyPCqEc4TAlJlsEthg-5eYUWpaizz0QjBzO7a1Yv4,1509
|
|
271
271
|
sqlmesh/utils/windows.py,sha256=r7Yin4WEwbvH7sKA3hOJtRsclmscNuBeCklCfVPvtQs,611
|
|
272
272
|
sqlmesh/utils/yaml.py,sha256=np-WVcwmwsKghCgAj1OBBMsK1SXSRn4wR-H37cGiFr8,2282
|
|
273
|
-
sqlmesh-0.187.6.
|
|
273
|
+
sqlmesh-0.187.6.dev23.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
|
|
274
274
|
web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
275
275
|
web/client/dist/index.html,sha256=QCrd8nHWTCuy7MMEEE_LbZ6ZDibolg6ZqxYJPP5gKUo,5472
|
|
276
276
|
web/client/dist/assets/Audits-BXuLcNW7.js,sha256=lxUVw0RvpALIqtvriOnq9f9kzUf2_MmyzXXol-5ZHVQ,1041
|
|
@@ -388,8 +388,8 @@ web/server/api/endpoints/models.py,sha256=ud-lRwriyI_OYg9tZchrBgeiXELiRTLNEodraf
|
|
|
388
388
|
web/server/api/endpoints/modules.py,sha256=8hqqgonGay_mJmpCw0IdbjsPhWlQH2VLdKAqha-myac,468
|
|
389
389
|
web/server/api/endpoints/plan.py,sha256=OYuQ_4dgbhG9ibTcX1a8mvYgH3ANxw9Fhbb4wg6QWqc,9222
|
|
390
390
|
web/server/api/endpoints/table_diff.py,sha256=Wd5YxeKbZB7AkrDvqFgvV9ZQlnKYOF1n5W_w2EHE_Zw,2085
|
|
391
|
-
sqlmesh-0.187.6.
|
|
392
|
-
sqlmesh-0.187.6.
|
|
393
|
-
sqlmesh-0.187.6.
|
|
394
|
-
sqlmesh-0.187.6.
|
|
395
|
-
sqlmesh-0.187.6.
|
|
391
|
+
sqlmesh-0.187.6.dev23.dist-info/METADATA,sha256=W1kiEiaNw3_ArMlClxa6YbZzA3KlCXAXyR81nzdW8Z8,26494
|
|
392
|
+
sqlmesh-0.187.6.dev23.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
393
|
+
sqlmesh-0.187.6.dev23.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
|
|
394
|
+
sqlmesh-0.187.6.dev23.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
|
|
395
|
+
sqlmesh-0.187.6.dev23.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|