sqlmesh 0.183.1.dev12__py3-none-any.whl → 0.183.1.dev13__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/macros.py +21 -17
- {sqlmesh-0.183.1.dev12.dist-info → sqlmesh-0.183.1.dev13.dist-info}/METADATA +1 -1
- {sqlmesh-0.183.1.dev12.dist-info → sqlmesh-0.183.1.dev13.dist-info}/RECORD +8 -8
- {sqlmesh-0.183.1.dev12.dist-info → sqlmesh-0.183.1.dev13.dist-info}/WHEEL +0 -0
- {sqlmesh-0.183.1.dev12.dist-info → sqlmesh-0.183.1.dev13.dist-info}/entry_points.txt +0 -0
- {sqlmesh-0.183.1.dev12.dist-info → sqlmesh-0.183.1.dev13.dist-info}/licenses/LICENSE +0 -0
- {sqlmesh-0.183.1.dev12.dist-info → sqlmesh-0.183.1.dev13.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.183.1.
|
|
21
|
-
__version_tuple__ = version_tuple = (0, 183, 1, '
|
|
20
|
+
__version__ = version = '0.183.1.dev13'
|
|
21
|
+
__version_tuple__ = version_tuple = (0, 183, 1, 'dev13')
|
sqlmesh/core/macros.py
CHANGED
|
@@ -1087,17 +1087,17 @@ def haversine_distance(
|
|
|
1087
1087
|
@macro()
|
|
1088
1088
|
def pivot(
|
|
1089
1089
|
evaluator: MacroEvaluator,
|
|
1090
|
-
column:
|
|
1091
|
-
values: t.
|
|
1092
|
-
alias:
|
|
1093
|
-
agg:
|
|
1094
|
-
cmp:
|
|
1095
|
-
prefix:
|
|
1096
|
-
suffix:
|
|
1097
|
-
then_value:
|
|
1098
|
-
else_value:
|
|
1099
|
-
quote:
|
|
1100
|
-
distinct:
|
|
1090
|
+
column: SQL,
|
|
1091
|
+
values: t.List[SQL],
|
|
1092
|
+
alias: bool = True,
|
|
1093
|
+
agg: SQL = SQL("SUM"),
|
|
1094
|
+
cmp: SQL = SQL("="),
|
|
1095
|
+
prefix: SQL = SQL(""),
|
|
1096
|
+
suffix: SQL = SQL(""),
|
|
1097
|
+
then_value: SQL = SQL("1"),
|
|
1098
|
+
else_value: SQL = SQL("0"),
|
|
1099
|
+
quote: bool = True,
|
|
1100
|
+
distinct: bool = False,
|
|
1101
1101
|
) -> t.List[exp.Expression]:
|
|
1102
1102
|
"""Returns a list of projections as a result of pivoting the given column on the given values.
|
|
1103
1103
|
|
|
@@ -1109,15 +1109,19 @@ def pivot(
|
|
|
1109
1109
|
'SELECT date_day, SUM(CASE WHEN status = \\'cancelled\\' THEN 1 ELSE 0 END) AS "\\'cancelled\\'", SUM(CASE WHEN status = \\'completed\\' THEN 1 ELSE 0 END) AS "\\'completed\\'" FROM rides GROUP BY 1'
|
|
1110
1110
|
"""
|
|
1111
1111
|
aggregates: t.List[exp.Expression] = []
|
|
1112
|
-
for value in values
|
|
1113
|
-
proj = f"{agg
|
|
1114
|
-
if distinct
|
|
1112
|
+
for value in values:
|
|
1113
|
+
proj = f"{agg}("
|
|
1114
|
+
if distinct:
|
|
1115
1115
|
proj += "DISTINCT "
|
|
1116
|
-
|
|
1116
|
+
|
|
1117
|
+
proj += f"CASE WHEN {column} {cmp} {value} THEN {then_value} ELSE {else_value} END) "
|
|
1117
1118
|
node = evaluator.parse_one(proj)
|
|
1118
|
-
|
|
1119
|
-
|
|
1119
|
+
|
|
1120
|
+
if alias:
|
|
1121
|
+
node = node.as_(f"{prefix}{value}{suffix}", quoted=quote, copy=False)
|
|
1122
|
+
|
|
1120
1123
|
aggregates.append(node)
|
|
1124
|
+
|
|
1121
1125
|
return aggregates
|
|
1122
1126
|
|
|
1123
1127
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
sqlmesh/__init__.py,sha256=DRovDXI-9D9xeYDP7t8Fq7mI31S2btlN-LHPOK3y7PA,7240
|
|
2
|
-
sqlmesh/_version.py,sha256=
|
|
2
|
+
sqlmesh/_version.py,sha256=r1h8oOb4Q5TZ8NJee8QttMuSQOnNvc4OpDwiNd4bVXk,530
|
|
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
|
|
@@ -19,7 +19,7 @@ sqlmesh/core/dialect.py,sha256=fPTV517IOS0nWMxYznNNQnXkQkFFrPOSKe8ghsQ0o8A,49759
|
|
|
19
19
|
sqlmesh/core/environment.py,sha256=0TTQf4C4LXwf37fm-dfYv1qyG7vtZfQI5rizgm5g0j0,11442
|
|
20
20
|
sqlmesh/core/lineage.py,sha256=zjB0Zfamo2Fja2r5SSZPMbrEKTXr1WjozZPVqvxdybI,3143
|
|
21
21
|
sqlmesh/core/loader.py,sha256=97_nTWdNdEnz-LNK7AO-tkH9mo_lpe5vJIDGMvaL-bs,31979
|
|
22
|
-
sqlmesh/core/macros.py,sha256=
|
|
22
|
+
sqlmesh/core/macros.py,sha256=itPrfJt8jXTtg5BMfMHShXca9sBpgeNGdv5hBhCUh90,58851
|
|
23
23
|
sqlmesh/core/node.py,sha256=r4_1MRTPcU0MAlwZ5KzrykLT58B7dkKvHzPCsJmEKD8,14497
|
|
24
24
|
sqlmesh/core/notification_target.py,sha256=PPGoDrgbRKxr27vJEu03XqNTQLYTw0ZF_b0yAapxGeI,16158
|
|
25
25
|
sqlmesh/core/reference.py,sha256=k7OSkLqTjPR8WJjNeFj0xAJ297nZUMgb_iTVwKRRKjc,4875
|
|
@@ -266,7 +266,7 @@ sqlmesh/utils/pandas.py,sha256=WmNlTLuv_qLelrcTnwb05QMaW53AYM6dpOW0o3dz6qM,2051
|
|
|
266
266
|
sqlmesh/utils/pydantic.py,sha256=ioaAzYF42PutEJRyAS11-AHguiCG3yWI6VRcTVa2G-g,10470
|
|
267
267
|
sqlmesh/utils/rich.py,sha256=xNZyPCqEc4TAlJlsEthg-5eYUWpaizz0QjBzO7a1Yv4,1509
|
|
268
268
|
sqlmesh/utils/yaml.py,sha256=np-WVcwmwsKghCgAj1OBBMsK1SXSRn4wR-H37cGiFr8,2282
|
|
269
|
-
sqlmesh-0.183.1.
|
|
269
|
+
sqlmesh-0.183.1.dev13.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
|
|
270
270
|
web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
271
271
|
web/client/dist/index.html,sha256=nPqIDCJmonOaEAp4hhwrwgPdwt_F-5zzw-WW1kJqq3I,5472
|
|
272
272
|
web/client/dist/assets/Audits-DiRd7NXk.js,sha256=Q5dIFqsHps-vVYD8037NpTPW_1juQgn_Ov45smEm7Y8,1041
|
|
@@ -384,8 +384,8 @@ web/server/api/endpoints/models.py,sha256=SzS5bshzdXyM6hb948sZ_3k-xhpGCHkxkb7pHz
|
|
|
384
384
|
web/server/api/endpoints/modules.py,sha256=8hqqgonGay_mJmpCw0IdbjsPhWlQH2VLdKAqha-myac,468
|
|
385
385
|
web/server/api/endpoints/plan.py,sha256=OYuQ_4dgbhG9ibTcX1a8mvYgH3ANxw9Fhbb4wg6QWqc,9222
|
|
386
386
|
web/server/api/endpoints/table_diff.py,sha256=Wd5YxeKbZB7AkrDvqFgvV9ZQlnKYOF1n5W_w2EHE_Zw,2085
|
|
387
|
-
sqlmesh-0.183.1.
|
|
388
|
-
sqlmesh-0.183.1.
|
|
389
|
-
sqlmesh-0.183.1.
|
|
390
|
-
sqlmesh-0.183.1.
|
|
391
|
-
sqlmesh-0.183.1.
|
|
387
|
+
sqlmesh-0.183.1.dev13.dist-info/METADATA,sha256=7NkwiO76SBBCfGw32NAtChvGgj6bOvJMwThr8MOy0Pc,25253
|
|
388
|
+
sqlmesh-0.183.1.dev13.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
|
389
|
+
sqlmesh-0.183.1.dev13.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
|
|
390
|
+
sqlmesh-0.183.1.dev13.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
|
|
391
|
+
sqlmesh-0.183.1.dev13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|