pytrilogy 0.0.2.1__py3-none-any.whl → 0.0.2.2__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.
- {pytrilogy-0.0.2.1.dist-info → pytrilogy-0.0.2.2.dist-info}/METADATA +1 -1
- {pytrilogy-0.0.2.1.dist-info → pytrilogy-0.0.2.2.dist-info}/RECORD +12 -12
- {pytrilogy-0.0.2.1.dist-info → pytrilogy-0.0.2.2.dist-info}/WHEEL +1 -1
- trilogy/__init__.py +1 -1
- trilogy/core/models.py +8 -0
- trilogy/core/processing/node_generators/select_node.py +2 -3
- trilogy/parsing/parse_engine.py +4 -0
- trilogy/parsing/render.py +7 -3
- trilogy/parsing/trilogy.lark +1 -1
- {pytrilogy-0.0.2.1.dist-info → pytrilogy-0.0.2.2.dist-info}/LICENSE.md +0 -0
- {pytrilogy-0.0.2.1.dist-info → pytrilogy-0.0.2.2.dist-info}/entry_points.txt +0 -0
- {pytrilogy-0.0.2.1.dist-info → pytrilogy-0.0.2.2.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
trilogy/__init__.py,sha256=
|
|
1
|
+
trilogy/__init__.py,sha256=mSeU_j02wb5aKd5vDcHQJdZaoG1AB96bCjUn2tIVpwk,290
|
|
2
2
|
trilogy/compiler.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
trilogy/constants.py,sha256=KIvi-cgU4R9urNgDdGiCsRkCrzjAfM4xGHhZb1SVy2w,881
|
|
4
4
|
trilogy/engine.py,sha256=R5ubIxYyrxRExz07aZCUfrTsoXCHQ8DKFTDsobXdWdA,1102
|
|
@@ -16,7 +16,7 @@ trilogy/core/exceptions.py,sha256=NvV_4qLOgKXbpotgRf7c8BANDEvHxlqRPaA53IThQ2o,56
|
|
|
16
16
|
trilogy/core/functions.py,sha256=xISGHMiUR9hFyoZe2l3VLTMO6UEtyGHQcMuovzlVRqw,9492
|
|
17
17
|
trilogy/core/graph_models.py,sha256=oJUMSpmYhqXlavckHLpR07GJxuQ8dZ1VbB1fB0KaS8c,2036
|
|
18
18
|
trilogy/core/internal.py,sha256=jNGFHKENnbMiMCtAgsnLZYVSENDK4b5ALecXFZpTDzQ,1075
|
|
19
|
-
trilogy/core/models.py,sha256=
|
|
19
|
+
trilogy/core/models.py,sha256=4iwlTfHzzmbDhm9vt7zgExMqY1xKyQL-fVG5Nrm-YTU,134722
|
|
20
20
|
trilogy/core/optimization.py,sha256=iX8BCh2BIEPJ6cYlcn7piDKFfig47azphhyqkwkYJM4,4291
|
|
21
21
|
trilogy/core/query_processor.py,sha256=PROehLEOMOuKy1EAUeIgdfGq1LrJsX0N7Z2qDED6S30,17580
|
|
22
22
|
trilogy/core/optimizations/__init__.py,sha256=pxRzNzd2g8oRMy4f_ub5va6bNS2pd4hnyp9JBzTKc1E,300
|
|
@@ -37,7 +37,7 @@ trilogy/core/processing/node_generators/group_to_node.py,sha256=BzPdYwzoo8gRMH7B
|
|
|
37
37
|
trilogy/core/processing/node_generators/multiselect_node.py,sha256=vP84dnLQy6dtypi6mUbt9sMAcmmrTgQ1Oz4GI6X1IEo,6421
|
|
38
38
|
trilogy/core/processing/node_generators/node_merge_node.py,sha256=YivTVrTEUJuQbQAHFVB2lUD4mJYQ-kTVVpwY4oT9A-Y,14664
|
|
39
39
|
trilogy/core/processing/node_generators/rowset_node.py,sha256=2ROd2c1_o4h5sbnDdaiL1o9UiiwyYw-B6OKyfHYNe0A,6188
|
|
40
|
-
trilogy/core/processing/node_generators/select_node.py,sha256=
|
|
40
|
+
trilogy/core/processing/node_generators/select_node.py,sha256=XGcz74XsWv5POWhV2gGC_jbi7T9g7sY-VtP3sjlppFc,19057
|
|
41
41
|
trilogy/core/processing/node_generators/unnest_node.py,sha256=6CH66eGwpadNX7TzUhWZ8aqIisOtQeHINbLV6X3QBUk,1779
|
|
42
42
|
trilogy/core/processing/node_generators/window_node.py,sha256=9nXUXUgQrNczU1gaOqhOZPNzCUxw-lkxt0R7HORI6ss,2582
|
|
43
43
|
trilogy/core/processing/nodes/__init__.py,sha256=-8ONG7Nqa6sNLpst5wNNyMigyaHRfUKGdE3xce8E3mM,3998
|
|
@@ -69,14 +69,14 @@ trilogy/parsing/common.py,sha256=8MDRPccWymtVkHVQMzESjL5tOH79flWU5jo6Ys-C5UQ,596
|
|
|
69
69
|
trilogy/parsing/config.py,sha256=Z-DaefdKhPDmSXLgg5V4pebhSB0h590vI0_VtHnlukI,111
|
|
70
70
|
trilogy/parsing/exceptions.py,sha256=92E5i2frv5hj9wxObJZsZqj5T6bglvPzvdvco_vW1Zk,38
|
|
71
71
|
trilogy/parsing/helpers.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
72
|
-
trilogy/parsing/parse_engine.py,sha256=
|
|
73
|
-
trilogy/parsing/render.py,sha256=
|
|
74
|
-
trilogy/parsing/trilogy.lark,sha256=
|
|
72
|
+
trilogy/parsing/parse_engine.py,sha256=rjTDs8AhJ6NjPCugfZCTdu7d_bUOSC9M8MAl9KmURNw,57763
|
|
73
|
+
trilogy/parsing/render.py,sha256=Gy_6wVYPwYLf35Iota08sbqveuWILtUhI8MYStcvtJM,12174
|
|
74
|
+
trilogy/parsing/trilogy.lark,sha256=Zn5UHqiNoVKa76r1af9KND0TNdsLIeHpyG3hJjUOOTQ,11000
|
|
75
75
|
trilogy/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
76
76
|
trilogy/scripts/trilogy.py,sha256=PHxvv6f2ODv0esyyhWxlARgra8dVhqQhYl0lTrSyVNo,3729
|
|
77
|
-
pytrilogy-0.0.2.
|
|
78
|
-
pytrilogy-0.0.2.
|
|
79
|
-
pytrilogy-0.0.2.
|
|
80
|
-
pytrilogy-0.0.2.
|
|
81
|
-
pytrilogy-0.0.2.
|
|
82
|
-
pytrilogy-0.0.2.
|
|
77
|
+
pytrilogy-0.0.2.2.dist-info/LICENSE.md,sha256=5ZRvtTyCCFwz1THxDTjAu3Lidds9WjPvvzgVwPSYNDo,1042
|
|
78
|
+
pytrilogy-0.0.2.2.dist-info/METADATA,sha256=rjwj8b_CWxQc82n5HJfPTBYlhtVKNUwIhAkWLusfA7g,7876
|
|
79
|
+
pytrilogy-0.0.2.2.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
|
|
80
|
+
pytrilogy-0.0.2.2.dist-info/entry_points.txt,sha256=0petKryjvvtEfTlbZC1AuMFumH_WQ9v8A19LvoS6G6c,54
|
|
81
|
+
pytrilogy-0.0.2.2.dist-info/top_level.txt,sha256=cAy__NW_eMAa_yT9UnUNlZLFfxcg6eimUAZ184cdNiE,8
|
|
82
|
+
pytrilogy-0.0.2.2.dist-info/RECORD,,
|
trilogy/__init__.py
CHANGED
trilogy/core/models.py
CHANGED
|
@@ -1822,6 +1822,7 @@ class Datasource(Namespaced, BaseModel):
|
|
|
1822
1822
|
metadata: DatasourceMetadata = Field(
|
|
1823
1823
|
default_factory=lambda: DatasourceMetadata(freshness_concept=None)
|
|
1824
1824
|
)
|
|
1825
|
+
where: Optional[WhereClause] = None
|
|
1825
1826
|
|
|
1826
1827
|
def merge_concept(
|
|
1827
1828
|
self, source: Concept, target: Concept, modifiers: List[Modifier]
|
|
@@ -1837,6 +1838,9 @@ class Datasource(Namespaced, BaseModel):
|
|
|
1837
1838
|
for c in self.columns
|
|
1838
1839
|
] + original
|
|
1839
1840
|
self.grain = self.grain.with_merge(source, target, modifiers)
|
|
1841
|
+
self.where = (
|
|
1842
|
+
self.where.with_merge(source, target, modifiers) if self.where else None
|
|
1843
|
+
)
|
|
1840
1844
|
del self.output_lcl
|
|
1841
1845
|
|
|
1842
1846
|
@property
|
|
@@ -1929,6 +1933,7 @@ class Datasource(Namespaced, BaseModel):
|
|
|
1929
1933
|
grain=self.grain.with_namespace(namespace),
|
|
1930
1934
|
address=self.address,
|
|
1931
1935
|
columns=[c.with_namespace(namespace) for c in self.columns],
|
|
1936
|
+
where=self.where.with_namespace(namespace) if self.where else None,
|
|
1932
1937
|
)
|
|
1933
1938
|
|
|
1934
1939
|
@cached_property
|
|
@@ -2806,6 +2811,9 @@ class EnvironmentDatasourceDict(dict):
|
|
|
2806
2811
|
return self.__getitem__(key.split(".")[1])
|
|
2807
2812
|
raise
|
|
2808
2813
|
|
|
2814
|
+
def values(self) -> ValuesView[Datasource]: # type: ignore
|
|
2815
|
+
return super().values()
|
|
2816
|
+
|
|
2809
2817
|
|
|
2810
2818
|
class EnvironmentConceptDict(dict):
|
|
2811
2819
|
def __init__(self, *args, **kwargs) -> None:
|
|
@@ -89,6 +89,7 @@ def dm_to_strategy_node(
|
|
|
89
89
|
accept_partial=accept_partial,
|
|
90
90
|
datasource=datasource,
|
|
91
91
|
grain=datasource.grain,
|
|
92
|
+
conditions=datasource.where.conditional if datasource.where else None,
|
|
92
93
|
)
|
|
93
94
|
# we need to nest the group node one further
|
|
94
95
|
if force_group is True:
|
|
@@ -295,9 +296,6 @@ def gen_select_node_from_table(
|
|
|
295
296
|
g.nodes[ncandidate]
|
|
296
297
|
except KeyError:
|
|
297
298
|
raise nx.exception.NetworkXNoPath
|
|
298
|
-
raise SyntaxError(
|
|
299
|
-
f"Could not find node {ncandidate}, have {list(g.nodes())}"
|
|
300
|
-
)
|
|
301
299
|
raise e
|
|
302
300
|
except nx.exception.NetworkXNoPath:
|
|
303
301
|
all_found = False
|
|
@@ -372,6 +370,7 @@ def gen_select_node_from_table(
|
|
|
372
370
|
accept_partial=accept_partial,
|
|
373
371
|
datasource=datasource,
|
|
374
372
|
grain=Grain(components=all_concepts),
|
|
373
|
+
conditions=datasource.where.conditional if datasource.where else None,
|
|
375
374
|
)
|
|
376
375
|
# we need to nest the group node one further
|
|
377
376
|
if force_group is True:
|
trilogy/parsing/parse_engine.py
CHANGED
|
@@ -605,6 +605,7 @@ class ParseToObjects(Transformer):
|
|
|
605
605
|
columns: List[ColumnAssignment] = args[1]
|
|
606
606
|
grain: Optional[Grain] = None
|
|
607
607
|
address: Optional[Address] = None
|
|
608
|
+
where: Optional[WhereClause] = None
|
|
608
609
|
for val in args[1:]:
|
|
609
610
|
if isinstance(val, Address):
|
|
610
611
|
address = val
|
|
@@ -612,6 +613,8 @@ class ParseToObjects(Transformer):
|
|
|
612
613
|
grain = val
|
|
613
614
|
elif isinstance(val, Query):
|
|
614
615
|
address = Address(location=f"({val.text})", is_query=True)
|
|
616
|
+
elif isinstance(val, WhereClause):
|
|
617
|
+
where = val
|
|
615
618
|
if not address:
|
|
616
619
|
raise ValueError(
|
|
617
620
|
"Malformed datasource, missing address or query declaration"
|
|
@@ -624,6 +627,7 @@ class ParseToObjects(Transformer):
|
|
|
624
627
|
grain=grain, # type: ignore
|
|
625
628
|
address=address,
|
|
626
629
|
namespace=self.environment.namespace,
|
|
630
|
+
where=where,
|
|
627
631
|
)
|
|
628
632
|
for column in columns:
|
|
629
633
|
column.concept = column.concept.with_grain(datasource.grain)
|
trilogy/parsing/render.py
CHANGED
|
@@ -131,11 +131,15 @@ class Renderer:
|
|
|
131
131
|
@to_string.register
|
|
132
132
|
def _(self, arg: Datasource):
|
|
133
133
|
assignments = ",\n\t".join([self.to_string(x) for x in arg.columns])
|
|
134
|
-
|
|
134
|
+
base = f"""datasource {arg.name} (
|
|
135
135
|
{assignments}
|
|
136
136
|
)
|
|
137
137
|
{self.to_string(arg.grain)}
|
|
138
|
-
{self.to_string(arg.address)}
|
|
138
|
+
{self.to_string(arg.address)}"""
|
|
139
|
+
if arg.where:
|
|
140
|
+
base += f"\n{self.to_string(arg.where)}"
|
|
141
|
+
base += ";"
|
|
142
|
+
return base
|
|
139
143
|
|
|
140
144
|
@to_string.register
|
|
141
145
|
def _(self, arg: "Grain"):
|
|
@@ -196,7 +200,7 @@ class Renderer:
|
|
|
196
200
|
|
|
197
201
|
@to_string.register
|
|
198
202
|
def _(self, arg: "ColumnAssignment"):
|
|
199
|
-
return f"{arg.alias}:{self.to_string(arg.concept)}"
|
|
203
|
+
return f"{arg.alias}: {self.to_string(arg.concept)}"
|
|
200
204
|
|
|
201
205
|
@to_string.register
|
|
202
206
|
def _(self, arg: "ConceptDeclarationStatement"):
|
trilogy/parsing/trilogy.lark
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
prop_ident: "<" IDENTIFIER ("," IDENTIFIER )* ","? ">" "." IDENTIFIER
|
|
36
36
|
|
|
37
37
|
// datasource concepts
|
|
38
|
-
datasource: "datasource" IDENTIFIER "(" column_assignment_list ")" grain_clause? (address | query)
|
|
38
|
+
datasource: "datasource" IDENTIFIER "(" column_assignment_list ")" grain_clause? (address | query) where?
|
|
39
39
|
|
|
40
40
|
grain_clause: "grain" "(" column_list ")"
|
|
41
41
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|