sqlmesh 0.186.2.dev16__py3-none-any.whl → 0.186.2.dev18__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/mssql.py +47 -1
- {sqlmesh-0.186.2.dev16.dist-info → sqlmesh-0.186.2.dev18.dist-info}/METADATA +1 -1
- {sqlmesh-0.186.2.dev16.dist-info → sqlmesh-0.186.2.dev18.dist-info}/RECORD +8 -8
- {sqlmesh-0.186.2.dev16.dist-info → sqlmesh-0.186.2.dev18.dist-info}/WHEEL +0 -0
- {sqlmesh-0.186.2.dev16.dist-info → sqlmesh-0.186.2.dev18.dist-info}/entry_points.txt +0 -0
- {sqlmesh-0.186.2.dev16.dist-info → sqlmesh-0.186.2.dev18.dist-info}/licenses/LICENSE +0 -0
- {sqlmesh-0.186.2.dev16.dist-info → sqlmesh-0.186.2.dev18.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.dev18'
|
|
21
|
+
__version_tuple__ = version_tuple = (0, 186, 2, 'dev18')
|
|
@@ -10,7 +10,11 @@ from pandas.api.types import is_datetime64_any_dtype # type: ignore
|
|
|
10
10
|
from sqlglot import exp
|
|
11
11
|
|
|
12
12
|
from sqlmesh.core.dialect import to_schema
|
|
13
|
-
from sqlmesh.core.engine_adapter.base import
|
|
13
|
+
from sqlmesh.core.engine_adapter.base import (
|
|
14
|
+
EngineAdapterWithIndexSupport,
|
|
15
|
+
EngineAdapter,
|
|
16
|
+
InsertOverwriteStrategy,
|
|
17
|
+
)
|
|
14
18
|
from sqlmesh.core.engine_adapter.mixins import (
|
|
15
19
|
GetCurrentCatalogFromFunctionMixin,
|
|
16
20
|
InsertOverwriteWithMergeMixin,
|
|
@@ -281,3 +285,45 @@ class MSSQLEngineAdapter(
|
|
|
281
285
|
# The function that renames tables in MSSQL takes string literals as arguments instead of identifiers,
|
|
282
286
|
# so we shouldn't quote the identifiers.
|
|
283
287
|
self.execute(exp.rename_table(old_table_name, new_table_name), quote_identifiers=False)
|
|
288
|
+
|
|
289
|
+
def _insert_overwrite_by_condition(
|
|
290
|
+
self,
|
|
291
|
+
table_name: TableName,
|
|
292
|
+
source_queries: t.List[SourceQuery],
|
|
293
|
+
columns_to_types: t.Optional[t.Dict[str, exp.DataType]] = None,
|
|
294
|
+
where: t.Optional[exp.Condition] = None,
|
|
295
|
+
insert_overwrite_strategy_override: t.Optional[InsertOverwriteStrategy] = None,
|
|
296
|
+
**kwargs: t.Any,
|
|
297
|
+
) -> None:
|
|
298
|
+
if not where or where == exp.true():
|
|
299
|
+
# this is a full table replacement, call the base strategy to do DELETE+INSERT
|
|
300
|
+
# which will result in TRUNCATE+INSERT due to how we have overridden self.delete_from()
|
|
301
|
+
return EngineAdapter._insert_overwrite_by_condition(
|
|
302
|
+
self,
|
|
303
|
+
table_name=table_name,
|
|
304
|
+
source_queries=source_queries,
|
|
305
|
+
columns_to_types=columns_to_types,
|
|
306
|
+
where=where,
|
|
307
|
+
insert_overwrite_strategy_override=InsertOverwriteStrategy.DELETE_INSERT,
|
|
308
|
+
**kwargs,
|
|
309
|
+
)
|
|
310
|
+
|
|
311
|
+
# For actual conditional overwrites, use MERGE from InsertOverwriteWithMergeMixin
|
|
312
|
+
return super()._insert_overwrite_by_condition(
|
|
313
|
+
table_name=table_name,
|
|
314
|
+
source_queries=source_queries,
|
|
315
|
+
columns_to_types=columns_to_types,
|
|
316
|
+
where=where,
|
|
317
|
+
insert_overwrite_strategy_override=insert_overwrite_strategy_override,
|
|
318
|
+
**kwargs,
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
def delete_from(self, table_name: TableName, where: t.Union[str, exp.Expression]) -> None:
|
|
322
|
+
if where == exp.true():
|
|
323
|
+
# "A TRUNCATE TABLE operation can be rolled back within a transaction."
|
|
324
|
+
# ref: https://learn.microsoft.com/en-us/sql/t-sql/statements/truncate-table-transact-sql?view=sql-server-ver15#remarks
|
|
325
|
+
return self.execute(
|
|
326
|
+
exp.TruncateTable(expressions=[exp.to_table(table_name, dialect=self.dialect)])
|
|
327
|
+
)
|
|
328
|
+
|
|
329
|
+
return super().delete_from(table_name, where)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
sqlmesh/__init__.py,sha256=69xw6bTmi4cW90M-sl3g6wLDgxVcLHcKg1q8GS3lqyA,7466
|
|
2
|
-
sqlmesh/_version.py,sha256=
|
|
2
|
+
sqlmesh/_version.py,sha256=23uEi0q4YZ9-xEEuuYzX2qYiIPhDRAIz-zuV9UYt5Ng,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
|
|
@@ -66,7 +66,7 @@ sqlmesh/core/engine_adapter/clickhouse.py,sha256=4ACsYsZ8-gvyCozwoEMEayTTUdMjmNe
|
|
|
66
66
|
sqlmesh/core/engine_adapter/databricks.py,sha256=AbNbnt9nQdOd7lTov2zsKROZlzgV2fLvOYXam3cowvk,14507
|
|
67
67
|
sqlmesh/core/engine_adapter/duckdb.py,sha256=FfNmBzLySDDi--nTlsSavTwdperCzhpYzDoroCilPcA,4900
|
|
68
68
|
sqlmesh/core/engine_adapter/mixins.py,sha256=HMB0Z9O3p5jaTZMolKiWKqpVDZokf5GoI99YXwEJ8bc,22470
|
|
69
|
-
sqlmesh/core/engine_adapter/mssql.py,sha256=
|
|
69
|
+
sqlmesh/core/engine_adapter/mssql.py,sha256=mkrHpdjow-R-F4R_wU0svLfcCNPOsK9mcalSOU9Cb1c,13797
|
|
70
70
|
sqlmesh/core/engine_adapter/mysql.py,sha256=lVC-siXZK3iSfqCmBjZNw8uy09Z8la8v8_oUZ-E2OwI,6966
|
|
71
71
|
sqlmesh/core/engine_adapter/postgres.py,sha256=fdQrsBodfGlNf8lZYkS99U_gjoDyaYKEVKLgScduv3I,4601
|
|
72
72
|
sqlmesh/core/engine_adapter/redshift.py,sha256=_rZWv4rchDAzB6m6idoV1NLHFBKK_gM4nlfeErqXEcE,16691
|
|
@@ -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.186.2.
|
|
273
|
+
sqlmesh-0.186.2.dev18.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=M50OuwjW63dRCS0Dz40Yecgvw9ecLFqizbTa6gv5Nd4,5472
|
|
276
276
|
web/client/dist/assets/Audits-BPlxzqeG.js,sha256=TCx1qCjCGgmUSvH6HoPr5t8ztbRXMlOxrcW4o7hRjlA,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.186.2.
|
|
392
|
-
sqlmesh-0.186.2.
|
|
393
|
-
sqlmesh-0.186.2.
|
|
394
|
-
sqlmesh-0.186.2.
|
|
395
|
-
sqlmesh-0.186.2.
|
|
391
|
+
sqlmesh-0.186.2.dev18.dist-info/METADATA,sha256=zjC2hE6KzopYHThETS-RzPimIwcnBi-IBr4Ogt_7rB4,25524
|
|
392
|
+
sqlmesh-0.186.2.dev18.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
|
393
|
+
sqlmesh-0.186.2.dev18.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
|
|
394
|
+
sqlmesh-0.186.2.dev18.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
|
|
395
|
+
sqlmesh-0.186.2.dev18.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|