sqlmesh 0.205.1.dev4__py3-none-any.whl → 0.205.1.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.205.1.dev4'
21
- __version_tuple__ = version_tuple = (0, 205, 1, 'dev4')
20
+ __version__ = version = '0.205.1.dev6'
21
+ __version_tuple__ = version_tuple = (0, 205, 1, 'dev6')
sqlmesh/core/macros.py CHANGED
@@ -361,8 +361,37 @@ class MacroEvaluator:
361
361
  return None
362
362
 
363
363
  if isinstance(result, (tuple, list)):
364
- return [self.parse_one(item) for item in result if item is not None]
365
- return self.parse_one(result)
364
+ result = [self.parse_one(item) for item in result if item is not None]
365
+
366
+ if (
367
+ len(result) == 1
368
+ and isinstance(result[0], (exp.Array, exp.Tuple))
369
+ and node.find_ancestor(MacroFunc)
370
+ ):
371
+ """
372
+ if:
373
+ - the output of evaluating this node is being passed as an argument to another macro function
374
+ - and that output is something that _norm_var_arg_lambda() will unpack into varargs
375
+ > (a list containing a single item of type exp.Tuple/exp.Array)
376
+ then we will get inconsistent behaviour depending on if this node emits a list with a single item vs multiple items.
377
+
378
+ In the first case, emitting a list containing a single array item will cause that array to get unpacked and its *members* passed to the calling macro
379
+ In the second case, emitting a list containing multiple array items will cause each item to get passed as-is to the calling macro
380
+
381
+ To prevent this inconsistency, we wrap this node output in an exp.Array so that _norm_var_arg_lambda() can "unpack" that into the
382
+ actual argument we want to pass to the parent macro function
383
+
384
+ Note we only do this for evaluation results that get passed as an argument to another macro, because when the final
385
+ result is given to something like SELECT, we still want that to be unpacked into a list of items like:
386
+ - SELECT ARRAY(1), ARRAY(2)
387
+ rather than a single item like:
388
+ - SELECT ARRAY(ARRAY(1), ARRAY(2))
389
+ """
390
+ result = [exp.Array(expressions=result)]
391
+ else:
392
+ result = self.parse_one(result)
393
+
394
+ return result
366
395
 
367
396
  def eval_expression(self, node: t.Any) -> t.Any:
368
397
  """Converts a SQLGlot expression into executable Python code and evals it.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlmesh
3
- Version: 0.205.1.dev4
3
+ Version: 0.205.1.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=QjwaamJIdW7voXoS880yAx7tHm-Im4_mqGA-XJgafos,7631
2
- sqlmesh/_version.py,sha256=rZRzp4g2FCgBGXHt1GXpJ4RK5Sh_jMQdy24whrSvmVA,528
2
+ sqlmesh/_version.py,sha256=Pje_jWH5ihusGqe8yaYAUpWlapi2z-UzwbBVtDGhnRU,528
3
3
  sqlmesh/magics.py,sha256=bEzYqXHcM0P3CjyUZ1O9arlmXAdLAhoglKbQ29fD9AE,41842
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=ELBtB8ft0OyalhgqQ1CUnn26xJxLDah2SP1v8kh_FB8,50903
19
19
  sqlmesh/core/environment.py,sha256=odus40R-YzdQdS_IiUq_tFouUXIhnpwmNwo8dE8Aw1k,13041
20
20
  sqlmesh/core/lineage.py,sha256=zjB0Zfamo2Fja2r5SSZPMbrEKTXr1WjozZPVqvxdybI,3143
21
21
  sqlmesh/core/loader.py,sha256=0C6eQFIK4gClXdWu1NlozBJ6AkKrGOxujUf0TyXlo18,40923
22
- sqlmesh/core/macros.py,sha256=3M3lChT2X5APuHyEprEbFfCXL31ab_2k3KkgPLKx6xE,60652
22
+ sqlmesh/core/macros.py,sha256=h99VzqXXjFZYA0t2730HKdq4NP6tYo-VKvcpwipAneQ,62422
23
23
  sqlmesh/core/node.py,sha256=3ChBz1PIMJhp-jzed_GLBrtmEF2v_BVDEM5WNe0ssPk,14658
24
24
  sqlmesh/core/notification_target.py,sha256=PPGoDrgbRKxr27vJEu03XqNTQLYTw0ZF_b0yAapxGeI,16158
25
25
  sqlmesh/core/reference.py,sha256=k7OSkLqTjPR8WJjNeFj0xAJ297nZUMgb_iTVwKRRKjc,4875
@@ -286,7 +286,7 @@ sqlmesh/utils/pydantic.py,sha256=o_NsXbIpDqNpUA1Uc5xF0ZzoXQYYB0DfHwdRxBwXPNk,120
286
286
  sqlmesh/utils/rich.py,sha256=cwQ5nJ6sgz64xHtoh6_ec7ReV5YpsOGhMtUJnwoRfEI,3549
287
287
  sqlmesh/utils/windows.py,sha256=r7Yin4WEwbvH7sKA3hOJtRsclmscNuBeCklCfVPvtQs,611
288
288
  sqlmesh/utils/yaml.py,sha256=hvo5lmybYLcIx4p6CQwufS8X4MbwS60lEBnCmYJCXmU,2336
289
- sqlmesh-0.205.1.dev4.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
289
+ sqlmesh-0.205.1.dev6.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
290
290
  web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
291
291
  web/client/dist/index.html,sha256=SXykdSRNgrT1k6I2dPZPEfpxPjIsi8-yVFijt-naSA4,5472
292
292
  web/client/dist/assets/Audits-Jm353fhk.js,sha256=ry6b5IKT3hLAfD5C3T2BqxulfauEV0n0YZ2vsP4eQ_U,1041
@@ -404,8 +404,8 @@ web/server/api/endpoints/models.py,sha256=kwj0s7uve3iZSMfmjkoPVMFMeY1sD0peTeyrWf
404
404
  web/server/api/endpoints/modules.py,sha256=8hqqgonGay_mJmpCw0IdbjsPhWlQH2VLdKAqha-myac,468
405
405
  web/server/api/endpoints/plan.py,sha256=bbbY50W_2MsZSTxOHWMKz0tbIm75nsRSlPy8GI2fg9Q,9306
406
406
  web/server/api/endpoints/table_diff.py,sha256=SCy3-pr5x6bEEiOaZGCDbiHQhpgxwmnz3Acqa2Ie6jI,2090
407
- sqlmesh-0.205.1.dev4.dist-info/METADATA,sha256=Imi2-9e7J6HTVPEV0FMRBRdWwS_7rEo1Ufhcuzu0_j0,26678
408
- sqlmesh-0.205.1.dev4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
409
- sqlmesh-0.205.1.dev4.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
410
- sqlmesh-0.205.1.dev4.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
411
- sqlmesh-0.205.1.dev4.dist-info/RECORD,,
407
+ sqlmesh-0.205.1.dev6.dist-info/METADATA,sha256=MpFhbu8uAghUO5ytF2Cc99-rNJ1fKQBioeGHHIlQzhU,26678
408
+ sqlmesh-0.205.1.dev6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
409
+ sqlmesh-0.205.1.dev6.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
410
+ sqlmesh-0.205.1.dev6.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
411
+ sqlmesh-0.205.1.dev6.dist-info/RECORD,,