pytrilogy 0.0.2.43__py3-none-any.whl → 0.0.2.44__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.

Potentially problematic release.


This version of pytrilogy might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pytrilogy
3
- Version: 0.0.2.43
3
+ Version: 0.0.2.44
4
4
  Summary: Declarative, typed query language that compiles to SQL.
5
5
  Home-page:
6
6
  Author:
@@ -1,4 +1,4 @@
1
- trilogy/__init__.py,sha256=ZEWVL1pix9g4txlIjL_AeU_gXI3663YOp9C-hV2cXeM,291
1
+ trilogy/__init__.py,sha256=fIzmFgsTur7NoKb9nhIHJxXi92LDugIbBG7NvACkML0,291
2
2
  trilogy/compiler.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  trilogy/constants.py,sha256=UPymm94T2c6a55XdDaXw0aleTe1pOJ6lf6gOWLKZyKg,1430
4
4
  trilogy/engine.py,sha256=R5ubIxYyrxRExz07aZCUfrTsoXCHQ8DKFTDsobXdWdA,1102
@@ -34,10 +34,10 @@ trilogy/core/processing/node_generators/common.py,sha256=eslHTTPFTkmwHwKIuUsbFn5
34
34
  trilogy/core/processing/node_generators/filter_node.py,sha256=Vz9Rb67e1dfZgnliekwwLeDPVkthMbdrnrKRdz7J1ik,7654
35
35
  trilogy/core/processing/node_generators/group_node.py,sha256=r54IVEhXW-tzod6uEHIQObrxgQt6aNySk5emWkWyqCU,4938
36
36
  trilogy/core/processing/node_generators/group_to_node.py,sha256=R9i_wHipxjXJyfYEwfeTw2EPpuanXVA327XyfcP2tBg,2537
37
- trilogy/core/processing/node_generators/multiselect_node.py,sha256=_KO9lqzHQoy4VAviO0ttQlmK0tjaqrJj4SJPhmoIYm8,6229
37
+ trilogy/core/processing/node_generators/multiselect_node.py,sha256=Prn0tWu6gpxyP1tJywVoMG6YAKB8kVRRpPMYdqnl6SE,6583
38
38
  trilogy/core/processing/node_generators/node_merge_node.py,sha256=dIEv5P2MTViAES2MzqJgccYzM3HldjHrQYFwH00cqyc,14003
39
39
  trilogy/core/processing/node_generators/rowset_node.py,sha256=KtdN6t2xM8CJxobc4aQX4W8uX98U6IabeuBF_FtBLR4,4583
40
- trilogy/core/processing/node_generators/select_merge_node.py,sha256=UF4xra2sJ6dGg9TLJUgqtTX-UxqUaCEfAGo-uq7HlVs,12139
40
+ trilogy/core/processing/node_generators/select_merge_node.py,sha256=zVPSYzhl-jSMobL7L1JauG03yNMkhKp0-tOVXiuC0Vo,12690
41
41
  trilogy/core/processing/node_generators/select_node.py,sha256=xTCWOoucRPBWkTccm5wepidhuZix-wd0YXWyOsy8nLs,1795
42
42
  trilogy/core/processing/node_generators/unnest_node.py,sha256=cZ26CN338CBnd6asML1OBUtNcDzmNlFpY0Vnade4yrc,2256
43
43
  trilogy/core/processing/node_generators/window_node.py,sha256=Ywb2K0T5Ym_Y4XStzIE2fuWV1fW2dp5eQ2hXVFTLsGM,3511
@@ -75,9 +75,9 @@ trilogy/parsing/render.py,sha256=-qqpXQg4yHcv284Vosjnsc_vrPveH6oaYbeCd3ZSvs0,156
75
75
  trilogy/parsing/trilogy.lark,sha256=B6NM3-rBHtYB_WSEti0DiS8Z-I8YH3kZU47xNzQvBx4,12389
76
76
  trilogy/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
77
77
  trilogy/scripts/trilogy.py,sha256=PHxvv6f2ODv0esyyhWxlARgra8dVhqQhYl0lTrSyVNo,3729
78
- pytrilogy-0.0.2.43.dist-info/LICENSE.md,sha256=5ZRvtTyCCFwz1THxDTjAu3Lidds9WjPvvzgVwPSYNDo,1042
79
- pytrilogy-0.0.2.43.dist-info/METADATA,sha256=Lx7C3ItHKIzLZwQ_nwBHpJrnYWyG3PR305v4SXcGzBs,8426
80
- pytrilogy-0.0.2.43.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
81
- pytrilogy-0.0.2.43.dist-info/entry_points.txt,sha256=0petKryjvvtEfTlbZC1AuMFumH_WQ9v8A19LvoS6G6c,54
82
- pytrilogy-0.0.2.43.dist-info/top_level.txt,sha256=cAy__NW_eMAa_yT9UnUNlZLFfxcg6eimUAZ184cdNiE,8
83
- pytrilogy-0.0.2.43.dist-info/RECORD,,
78
+ pytrilogy-0.0.2.44.dist-info/LICENSE.md,sha256=5ZRvtTyCCFwz1THxDTjAu3Lidds9WjPvvzgVwPSYNDo,1042
79
+ pytrilogy-0.0.2.44.dist-info/METADATA,sha256=RxCccw965AUjLdlWfAfnBSub9kBZAD5Hh-qJgcY9i90,8426
80
+ pytrilogy-0.0.2.44.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
81
+ pytrilogy-0.0.2.44.dist-info/entry_points.txt,sha256=0petKryjvvtEfTlbZC1AuMFumH_WQ9v8A19LvoS6G6c,54
82
+ pytrilogy-0.0.2.44.dist-info/top_level.txt,sha256=cAy__NW_eMAa_yT9UnUNlZLFfxcg6eimUAZ184cdNiE,8
83
+ pytrilogy-0.0.2.44.dist-info/RECORD,,
trilogy/__init__.py CHANGED
@@ -4,6 +4,6 @@ from trilogy.executor import Executor
4
4
  from trilogy.parser import parse
5
5
  from trilogy.constants import CONFIG
6
6
 
7
- __version__ = "0.0.2.43"
7
+ __version__ = "0.0.2.44"
8
8
 
9
9
  __all__ = ["parse", "Executor", "Dialects", "Environment", "CONFIG"]
@@ -3,6 +3,7 @@ from trilogy.core.models import (
3
3
  Environment,
4
4
  MultiSelectStatement,
5
5
  WhereClause,
6
+ Conditional,
6
7
  )
7
8
  from trilogy.core.processing.nodes import MergeNode, NodeJoin, History
8
9
  from trilogy.core.processing.nodes.base_node import concept_list_to_grain, StrategyNode
@@ -14,7 +15,7 @@ from trilogy.core.processing.utility import padding
14
15
  from trilogy.core.processing.utility import concept_to_relevant_joins
15
16
  from collections import defaultdict
16
17
  from itertools import combinations
17
- from trilogy.core.enums import Purpose
18
+ from trilogy.core.enums import Purpose, BooleanOperator
18
19
  from trilogy.core.processing.node_generators.common import resolve_join_order
19
20
 
20
21
  LOGGER_PREFIX = "[GEN_MULTISELECT_NODE]"
@@ -76,14 +77,22 @@ def gen_multiselect_node(
76
77
  g=g,
77
78
  depth=depth + 1,
78
79
  history=history,
80
+ conditions=select.where_clause,
79
81
  )
80
82
  if not snode:
81
83
  logger.info(
82
84
  f"{padding(depth)}{LOGGER_PREFIX} Cannot generate multiselect node for {concept}"
83
85
  )
84
86
  return None
85
- if select.where_clause:
86
- snode.conditions = select.where_clause.conditional
87
+ if select.having_clause:
88
+ if snode.conditions:
89
+ snode.conditions = Conditional(
90
+ left=snode.conditions,
91
+ right=select.having_clause.conditional,
92
+ operator=BooleanOperator.AND,
93
+ )
94
+ else:
95
+ snode.conditions = select.having_clause.conditional
87
96
  merge_concepts = []
88
97
  for x in [*snode.output_concepts]:
89
98
  merge = lineage.get_merge_concept(x)
@@ -20,6 +20,9 @@ from trilogy.core.graph_models import concept_to_node
20
20
  from trilogy.constants import logger
21
21
  from trilogy.core.processing.utility import padding
22
22
  from trilogy.core.enums import PurposeLineage
23
+ from trilogy.core.processing.nodes.base_node import (
24
+ concept_list_to_grain,
25
+ )
23
26
 
24
27
  LOGGER_PREFIX = "[GEN_ROOT_MERGE_NODE]"
25
28
 
@@ -353,7 +356,7 @@ def gen_select_merge_node(
353
356
  ]
354
357
  ):
355
358
  preexisting_conditions = conditions.conditional
356
- return MergeNode(
359
+ base = MergeNode(
357
360
  output_concepts=all_concepts,
358
361
  input_concepts=non_constant,
359
362
  environment=environment,
@@ -362,3 +365,16 @@ def gen_select_merge_node(
362
365
  parents=parents,
363
366
  preexisting_conditions=preexisting_conditions,
364
367
  )
368
+ target_grain = concept_list_to_grain(all_concepts, [])
369
+ if not base.resolve().grain.issubset(target_grain):
370
+ return GroupNode(
371
+ output_concepts=all_concepts,
372
+ input_concepts=all_concepts,
373
+ environment=environment,
374
+ g=g,
375
+ parents=[base],
376
+ depth=depth,
377
+ preexisting_conditions=preexisting_conditions,
378
+ partial_concepts=base.partial_concepts,
379
+ )
380
+ return base