sqlmesh 0.184.3.dev4__py3-none-any.whl → 0.184.3.dev6__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 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.184.3.dev4'
21
- __version_tuple__ = version_tuple = (0, 184, 3, 'dev4')
20
+ __version__ = version = '0.184.3.dev6'
21
+ __version_tuple__ = version_tuple = (0, 184, 3, 'dev6')
@@ -4,6 +4,7 @@ import abc
4
4
  import base64
5
5
  import logging
6
6
  import os
7
+ import importlib
7
8
  import pathlib
8
9
  import re
9
10
  import typing as t
@@ -24,6 +25,7 @@ from sqlmesh.core.config.common import (
24
25
  )
25
26
  from sqlmesh.core.engine_adapter.shared import CatalogSupport
26
27
  from sqlmesh.core.engine_adapter import EngineAdapter
28
+ from sqlmesh.utils import str_to_bool
27
29
  from sqlmesh.utils.errors import ConfigError
28
30
  from sqlmesh.utils.pydantic import (
29
31
  ValidationInfo,
@@ -49,6 +51,30 @@ FORBIDDEN_STATE_SYNC_ENGINES = {
49
51
  MOTHERDUCK_TOKEN_REGEX = re.compile(r"(\?|\&)(motherduck_token=)(\S*)")
50
52
 
51
53
 
54
+ def _get_engine_import_validator(
55
+ import_name: str, engine_type: str, extra_name: t.Optional[str] = None
56
+ ) -> t.Callable:
57
+ extra_name = extra_name or engine_type
58
+
59
+ @model_validator(mode="before")
60
+ def validate(cls: t.Any, data: t.Any) -> t.Any:
61
+ check_import = (
62
+ str_to_bool(str(data.pop("check_import", True))) if isinstance(data, dict) else True
63
+ )
64
+ if not check_import:
65
+ return data
66
+ try:
67
+ importlib.import_module(import_name)
68
+ except ImportError:
69
+ raise ConfigError(
70
+ f"Failed to import the '{engine_type}' engine library. Please run `pip install \"sqlmesh[{extra_name}]\"`."
71
+ )
72
+
73
+ return data
74
+
75
+ return validate
76
+
77
+
52
78
  class ConnectionConfig(abc.ABC, BaseConfig):
53
79
  type_: str
54
80
  concurrent_tasks: int
@@ -428,6 +454,7 @@ class SnowflakeConnectionConfig(ConnectionConfig):
428
454
  type_: t.Literal["snowflake"] = Field(alias="type", default="snowflake")
429
455
 
430
456
  _concurrent_tasks_validator = concurrent_tasks_validator
457
+ _engine_import_validator = _get_engine_import_validator("snowflake", "snowflake")
431
458
 
432
459
  @model_validator(mode="before")
433
460
  def _validate_authenticator(cls, data: t.Any) -> t.Any:
@@ -621,6 +648,7 @@ class DatabricksConnectionConfig(ConnectionConfig):
621
648
 
622
649
  _concurrent_tasks_validator = concurrent_tasks_validator
623
650
  _http_headers_validator = http_headers_validator
651
+ _engine_import_validator = _get_engine_import_validator("databricks", "databricks")
624
652
 
625
653
  @model_validator(mode="before")
626
654
  def _databricks_connect_validator(cls, data: t.Any) -> t.Any:
@@ -873,6 +901,8 @@ class BigQueryConnectionConfig(ConnectionConfig):
873
901
 
874
902
  type_: t.Literal["bigquery"] = Field(alias="type", default="bigquery")
875
903
 
904
+ _engine_import_validator = _get_engine_import_validator("google.cloud.bigquery", "bigquery")
905
+
876
906
  @field_validator("execution_project")
877
907
  def validate_execution_project(
878
908
  cls,
@@ -1015,6 +1045,10 @@ class GCPPostgresConnectionConfig(ConnectionConfig):
1015
1045
  register_comments: bool = True
1016
1046
  pre_ping: bool = True
1017
1047
 
1048
+ _engine_import_validator = _get_engine_import_validator(
1049
+ "google.cloud.sql", "gcp_postgres", "gcppostgres"
1050
+ )
1051
+
1018
1052
  @model_validator(mode="before")
1019
1053
  def _validate_auth_method(cls, data: t.Any) -> t.Any:
1020
1054
  if not isinstance(data, dict):
@@ -1142,6 +1176,8 @@ class RedshiftConnectionConfig(ConnectionConfig):
1142
1176
 
1143
1177
  type_: t.Literal["redshift"] = Field(alias="type", default="redshift")
1144
1178
 
1179
+ _engine_import_validator = _get_engine_import_validator("redshift_connector", "redshift")
1180
+
1145
1181
  @property
1146
1182
  def _connection_kwargs_keys(self) -> t.Set[str]:
1147
1183
  return {
@@ -1201,6 +1237,8 @@ class PostgresConnectionConfig(ConnectionConfig):
1201
1237
 
1202
1238
  type_: t.Literal["postgres"] = Field(alias="type", default="postgres")
1203
1239
 
1240
+ _engine_import_validator = _get_engine_import_validator("psycopg2", "postgres")
1241
+
1204
1242
  @property
1205
1243
  def _connection_kwargs_keys(self) -> t.Set[str]:
1206
1244
  return {
@@ -1252,6 +1290,8 @@ class MySQLConnectionConfig(ConnectionConfig):
1252
1290
 
1253
1291
  type_: t.Literal["mysql"] = Field(alias="type", default="mysql")
1254
1292
 
1293
+ _engine_import_validator = _get_engine_import_validator("pymysql", "mysql")
1294
+
1255
1295
  @property
1256
1296
  def _connection_kwargs_keys(self) -> t.Set[str]:
1257
1297
  connection_keys = {
@@ -1302,6 +1342,8 @@ class MSSQLConnectionConfig(ConnectionConfig):
1302
1342
 
1303
1343
  type_: t.Literal["mssql"] = Field(alias="type", default="mssql")
1304
1344
 
1345
+ _engine_import_validator = _get_engine_import_validator("pymssql", "mssql")
1346
+
1305
1347
  @property
1306
1348
  def _connection_kwargs_keys(self) -> t.Set[str]:
1307
1349
  return {
@@ -1357,6 +1399,8 @@ class SparkConnectionConfig(ConnectionConfig):
1357
1399
 
1358
1400
  type_: t.Literal["spark"] = Field(alias="type", default="spark")
1359
1401
 
1402
+ _engine_import_validator = _get_engine_import_validator("pyspark", "spark")
1403
+
1360
1404
  @property
1361
1405
  def _connection_kwargs_keys(self) -> t.Set[str]:
1362
1406
  return {
@@ -1473,6 +1517,8 @@ class TrinoConnectionConfig(ConnectionConfig):
1473
1517
 
1474
1518
  type_: t.Literal["trino"] = Field(alias="type", default="trino")
1475
1519
 
1520
+ _engine_import_validator = _get_engine_import_validator("trino", "trino")
1521
+
1476
1522
  @field_validator("schema_location_mapping", mode="before")
1477
1523
  @classmethod
1478
1524
  def _validate_regex_keys(
@@ -1623,6 +1669,8 @@ class ClickhouseConnectionConfig(ConnectionConfig):
1623
1669
 
1624
1670
  type_: t.Literal["clickhouse"] = Field(alias="type", default="clickhouse")
1625
1671
 
1672
+ _engine_import_validator = _get_engine_import_validator("clickhouse_connect", "clickhouse")
1673
+
1626
1674
  @property
1627
1675
  def _connection_kwargs_keys(self) -> t.Set[str]:
1628
1676
  kwargs = {
@@ -1727,6 +1775,8 @@ class AthenaConnectionConfig(ConnectionConfig):
1727
1775
 
1728
1776
  type_: t.Literal["athena"] = Field(alias="type", default="athena")
1729
1777
 
1778
+ _engine_import_validator = _get_engine_import_validator("pyathena", "athena")
1779
+
1730
1780
  @model_validator(mode="after")
1731
1781
  def _root_validator(self) -> Self:
1732
1782
  work_group = self.work_group
@@ -1793,6 +1843,8 @@ class RisingwaveConnectionConfig(ConnectionConfig):
1793
1843
 
1794
1844
  type_: t.Literal["risingwave"] = Field(alias="type", default="risingwave")
1795
1845
 
1846
+ _engine_import_validator = _get_engine_import_validator("psycopg2", "risingwave")
1847
+
1796
1848
  @property
1797
1849
  def _connection_kwargs_keys(self) -> t.Set[str]:
1798
1850
  return {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlmesh
3
- Version: 0.184.3.dev4
3
+ Version: 0.184.3.dev6
4
4
  Summary: Next-generation data transformation framework
5
5
  Author-email: "TobikoData Inc." <engineering@tobikodata.com>
6
6
  License: Apache License
@@ -1,5 +1,5 @@
1
1
  sqlmesh/__init__.py,sha256=DRovDXI-9D9xeYDP7t8Fq7mI31S2btlN-LHPOK3y7PA,7240
2
- sqlmesh/_version.py,sha256=ksEoo41xoItz3s5IFUP87s5gTaVfLoWPFvNsL0jUOow,528
2
+ sqlmesh/_version.py,sha256=Hrh7Bxarss4lFNHO4Sg4-OnyJtKuXsq_5gMlLZRxZ6U,528
3
3
  sqlmesh/magics.py,sha256=9oY1Uz8uwsuTtPRg9HTYDxnGiJ7-OVRCpmCgAhbKHUU,39431
4
4
  sqlmesh/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  sqlmesh/cicd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -41,7 +41,7 @@ sqlmesh/core/config/__init__.py,sha256=b4gFb04tpeZpowqJD-7h3U3TLgxrpQhZahVEAo6VW
41
41
  sqlmesh/core/config/base.py,sha256=t8NQmsgQoZSc-k0dlDiCb8t1jj0AMYdGZ-6se9q_Pks,4898
42
42
  sqlmesh/core/config/categorizer.py,sha256=6vzUoNLjR6GOEb_2mYVz2TwmMv2BfldgHX2u-Le5HZs,1975
43
43
  sqlmesh/core/config/common.py,sha256=-o_HoRFtR4u84frg_TLno7z7vS9II6ASiOayb59MKHo,2806
44
- sqlmesh/core/config/connection.py,sha256=hWwoMeB8MD_ou57fJG_Rb0tmzHwqVjR9rR1fEs_Xu50,70008
44
+ sqlmesh/core/config/connection.py,sha256=kMhHzIKAIz2uiM5XhRgn-yMUOVS1B_aJEmIejGnUClo,71976
45
45
  sqlmesh/core/config/feature_flag.py,sha256=JRcD31OG_t2cYc24meKbHDGB0iVID0P07V2oOeB_mgA,203
46
46
  sqlmesh/core/config/format.py,sha256=6CXFbvnor56xbldKE-Vrm9k_ABRoY4v6vgIb3mCihiQ,1355
47
47
  sqlmesh/core/config/gateway.py,sha256=tYngyqwd_4Qr9lhcv2hlvLvb_2pgYYtKu6hdGsTr-4I,1931
@@ -267,7 +267,7 @@ sqlmesh/utils/pandas.py,sha256=uKI-ygEtMcGDRzXdBu0RkGmMBkYxwu5O2Wabho841Ls,2196
267
267
  sqlmesh/utils/pydantic.py,sha256=-u69PDY-4FLR7ODNKBoN7PsPNmZ0wdhsJcCAG2P6vyY,11061
268
268
  sqlmesh/utils/rich.py,sha256=xNZyPCqEc4TAlJlsEthg-5eYUWpaizz0QjBzO7a1Yv4,1509
269
269
  sqlmesh/utils/yaml.py,sha256=np-WVcwmwsKghCgAj1OBBMsK1SXSRn4wR-H37cGiFr8,2282
270
- sqlmesh-0.184.3.dev4.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
270
+ sqlmesh-0.184.3.dev6.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
271
271
  web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
272
272
  web/client/dist/index.html,sha256=f4Pg8Cex2Yzuh8nwt5XduYLO41HKza9RIL0rW1d9wKw,5472
273
273
  web/client/dist/assets/Audits-DF7amJxU.js,sha256=VxuJ7bKHmPaqK8SvZaqdeSB_m9-oI7fi6HND54mJ4Y0,1041
@@ -385,8 +385,8 @@ web/server/api/endpoints/models.py,sha256=SzS5bshzdXyM6hb948sZ_3k-xhpGCHkxkb7pHz
385
385
  web/server/api/endpoints/modules.py,sha256=8hqqgonGay_mJmpCw0IdbjsPhWlQH2VLdKAqha-myac,468
386
386
  web/server/api/endpoints/plan.py,sha256=OYuQ_4dgbhG9ibTcX1a8mvYgH3ANxw9Fhbb4wg6QWqc,9222
387
387
  web/server/api/endpoints/table_diff.py,sha256=Wd5YxeKbZB7AkrDvqFgvV9ZQlnKYOF1n5W_w2EHE_Zw,2085
388
- sqlmesh-0.184.3.dev4.dist-info/METADATA,sha256=MDrLhAex-0Vq5cLz4TGlXiHjbjNT3rF1gWlxLpA-OD4,25498
389
- sqlmesh-0.184.3.dev4.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
390
- sqlmesh-0.184.3.dev4.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
391
- sqlmesh-0.184.3.dev4.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
392
- sqlmesh-0.184.3.dev4.dist-info/RECORD,,
388
+ sqlmesh-0.184.3.dev6.dist-info/METADATA,sha256=0BJHQ_ifMvCyWErdhA-sQyI1iP9PxFaciYhayno28dw,25498
389
+ sqlmesh-0.184.3.dev6.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
390
+ sqlmesh-0.184.3.dev6.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
391
+ sqlmesh-0.184.3.dev6.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
392
+ sqlmesh-0.184.3.dev6.dist-info/RECORD,,