pytrilogy 0.0.3.42__py3-none-any.whl → 0.0.3.43__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.3.42.dist-info → pytrilogy-0.0.3.43.dist-info}/METADATA +1 -1
- {pytrilogy-0.0.3.42.dist-info → pytrilogy-0.0.3.43.dist-info}/RECORD +10 -10
- {pytrilogy-0.0.3.42.dist-info → pytrilogy-0.0.3.43.dist-info}/WHEEL +1 -1
- trilogy/__init__.py +1 -1
- trilogy/core/processing/node_generators/window_node.py +9 -1
- trilogy/dialect/bigquery.py +1 -1
- trilogy/parsing/parse_engine.py +23 -6
- {pytrilogy-0.0.3.42.dist-info → pytrilogy-0.0.3.43.dist-info}/entry_points.txt +0 -0
- {pytrilogy-0.0.3.42.dist-info → pytrilogy-0.0.3.43.dist-info}/licenses/LICENSE.md +0 -0
- {pytrilogy-0.0.3.42.dist-info → pytrilogy-0.0.3.43.dist-info}/top_level.txt +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
pytrilogy-0.0.3.
|
|
2
|
-
trilogy/__init__.py,sha256=
|
|
1
|
+
pytrilogy-0.0.3.43.dist-info/licenses/LICENSE.md,sha256=5ZRvtTyCCFwz1THxDTjAu3Lidds9WjPvvzgVwPSYNDo,1042
|
|
2
|
+
trilogy/__init__.py,sha256=4cXB9506hb2gprGWKbo-5R8LE3DuFBSrMfMr82Gwvn4,303
|
|
3
3
|
trilogy/compiler.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
trilogy/constants.py,sha256=5eQxk1A0pv-TQk3CCvgZCFA9_K-6nxrOm7E5Lxd7KIY,1652
|
|
5
5
|
trilogy/engine.py,sha256=OK2RuqCIUId6yZ5hfF8J1nxGP0AJqHRZiafcowmW0xc,1728
|
|
@@ -52,7 +52,7 @@ trilogy/core/processing/node_generators/select_node.py,sha256=Y-zO0AFkTrpi2Lyebj
|
|
|
52
52
|
trilogy/core/processing/node_generators/synonym_node.py,sha256=9LHK2XHDjbyTLjmDQieskG8fqbiSpRnFOkfrutDnOTE,2258
|
|
53
53
|
trilogy/core/processing/node_generators/union_node.py,sha256=VNo6Oey4p8etU9xrOh2oTT2lIOTvY6PULUPRvVa2uxU,2877
|
|
54
54
|
trilogy/core/processing/node_generators/unnest_node.py,sha256=cOEKnMRzXUW3bwmiOlgn3E1-B38osng0dh2pDykwITY,2410
|
|
55
|
-
trilogy/core/processing/node_generators/window_node.py,sha256=
|
|
55
|
+
trilogy/core/processing/node_generators/window_node.py,sha256=lj94LRcJaypyfLEucQwIn65ZQsSAkYV_r1esFhPRUDc,6047
|
|
56
56
|
trilogy/core/processing/node_generators/select_helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
57
57
|
trilogy/core/processing/node_generators/select_helpers/datasource_injection.py,sha256=GMW07bb6hXurhF0hZLYoMAKSIS65tat5hwBjvqqPeSA,6516
|
|
58
58
|
trilogy/core/processing/nodes/__init__.py,sha256=Lxr3rs_bqOAtMtn3DHIkY058ZzjyLM5mSfGMKW2z0NY,5555
|
|
@@ -71,7 +71,7 @@ trilogy/core/statements/common.py,sha256=KxEmz2ySySyZ6CTPzn0fJl5NX2KOk1RPyuUSwWh
|
|
|
71
71
|
trilogy/core/statements/execute.py,sha256=cSlvpHFOqpiZ89pPZ5GDp9Hu6j6uj-5_h21FWm_L-KM,1248
|
|
72
72
|
trilogy/dialect/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
73
73
|
trilogy/dialect/base.py,sha256=vp6_9fUkblAWVpCXGBIcoAx6N7vof9M7s9t6-b_waUY,41409
|
|
74
|
-
trilogy/dialect/bigquery.py,sha256=
|
|
74
|
+
trilogy/dialect/bigquery.py,sha256=7LcgPLDkeNBk6YTfaE-RBBi7SjWFV-jjuvZM1VMIXqk,3350
|
|
75
75
|
trilogy/dialect/common.py,sha256=XjHkP8Dqezjkd2JU5xoAlMRS_6HNyXQCF4CykLK3C8o,5011
|
|
76
76
|
trilogy/dialect/config.py,sha256=olnyeVU5W5T6b9-dMeNAnvxuPlyc2uefb7FRME094Ec,3834
|
|
77
77
|
trilogy/dialect/dataframe.py,sha256=RUbNgReEa9g3pL6H7fP9lPTrAij5pkqedpZ99D8_5AE,1522
|
|
@@ -91,7 +91,7 @@ trilogy/parsing/common.py,sha256=2KwR86ZNH04tcs500l02jLPkFaStEYc9wtR1NVO6cYo,264
|
|
|
91
91
|
trilogy/parsing/config.py,sha256=Z-DaefdKhPDmSXLgg5V4pebhSB0h590vI0_VtHnlukI,111
|
|
92
92
|
trilogy/parsing/exceptions.py,sha256=92E5i2frv5hj9wxObJZsZqj5T6bglvPzvdvco_vW1Zk,38
|
|
93
93
|
trilogy/parsing/helpers.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
94
|
-
trilogy/parsing/parse_engine.py,sha256=
|
|
94
|
+
trilogy/parsing/parse_engine.py,sha256=tsEBRyG2fzHUdiO1oW2mB_36vNZOfjFA4MXuf0zpF2E,65547
|
|
95
95
|
trilogy/parsing/render.py,sha256=hI4y-xjXrEXvHslY2l2TQ8ic0zAOpN41ADH37J2_FZY,19047
|
|
96
96
|
trilogy/parsing/trilogy.lark,sha256=2Noe58vGYteilKd6w-np3fb4lzWI-G9Gt0AMyOMVw3k,13735
|
|
97
97
|
trilogy/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -102,8 +102,8 @@ trilogy/std/display.preql,sha256=2BbhvqR4rcltyAbOXAUo7SZ_yGFYZgFnurglHMbjW2g,40
|
|
|
102
102
|
trilogy/std/geography.preql,sha256=-fqAGnBL6tR-UtT8DbSek3iMFg66ECR_B_41pODxv-k,504
|
|
103
103
|
trilogy/std/money.preql,sha256=ZHW-csTX-kYbOLmKSO-TcGGgQ-_DMrUXy0BjfuJSFxM,80
|
|
104
104
|
trilogy/std/report.preql,sha256=LbV-XlHdfw0jgnQ8pV7acG95xrd1-p65fVpiIc-S7W4,202
|
|
105
|
-
pytrilogy-0.0.3.
|
|
106
|
-
pytrilogy-0.0.3.
|
|
107
|
-
pytrilogy-0.0.3.
|
|
108
|
-
pytrilogy-0.0.3.
|
|
109
|
-
pytrilogy-0.0.3.
|
|
105
|
+
pytrilogy-0.0.3.43.dist-info/METADATA,sha256=0cC502qzl6dYCgRsnS4Gi8LqcpV1Ozu7JKdYaqc69mM,9100
|
|
106
|
+
pytrilogy-0.0.3.43.dist-info/WHEEL,sha256=wXxTzcEDnjrTwFYjLPcsW_7_XihufBwmpiBeiXNBGEA,91
|
|
107
|
+
pytrilogy-0.0.3.43.dist-info/entry_points.txt,sha256=ewBPU2vLnVexZVnB-NrVj-p3E-4vukg83Zk8A55Wp2w,56
|
|
108
|
+
pytrilogy-0.0.3.43.dist-info/top_level.txt,sha256=cAy__NW_eMAa_yT9UnUNlZLFfxcg6eimUAZ184cdNiE,8
|
|
109
|
+
pytrilogy-0.0.3.43.dist-info/RECORD,,
|
trilogy/__init__.py
CHANGED
|
@@ -61,6 +61,9 @@ def gen_window_node(
|
|
|
61
61
|
# append in keys to get the right grain
|
|
62
62
|
if concept.keys:
|
|
63
63
|
for item in concept.keys:
|
|
64
|
+
logger.info(
|
|
65
|
+
f"{padding(depth)}{LOGGER_PREFIX} appending search for key {item}"
|
|
66
|
+
)
|
|
64
67
|
targets.append(environment.concepts[item])
|
|
65
68
|
additional_outputs = []
|
|
66
69
|
if equivalent_optional:
|
|
@@ -72,10 +75,15 @@ def gen_window_node(
|
|
|
72
75
|
additional_outputs.append(x)
|
|
73
76
|
|
|
74
77
|
grain_equivalents = [
|
|
75
|
-
x
|
|
78
|
+
x
|
|
79
|
+
for x in local_optional
|
|
80
|
+
if x.keys
|
|
81
|
+
and all([key in targets for key in x.keys])
|
|
82
|
+
and x.grain == concept.grain
|
|
76
83
|
]
|
|
77
84
|
|
|
78
85
|
for x in grain_equivalents:
|
|
86
|
+
logger.info("Appending grain equivalent %s", x)
|
|
79
87
|
targets.append(x)
|
|
80
88
|
|
|
81
89
|
# finally, the ones we'll need to enrich
|
trilogy/dialect/bigquery.py
CHANGED
|
@@ -34,7 +34,7 @@ FUNCTION_MAP = {
|
|
|
34
34
|
|
|
35
35
|
FUNCTION_GRAIN_MATCH_MAP = {
|
|
36
36
|
**FUNCTION_MAP,
|
|
37
|
-
FunctionType.COUNT: lambda args:
|
|
37
|
+
FunctionType.COUNT: lambda args: "1",
|
|
38
38
|
FunctionType.SUM: lambda args: f"{args[0]}",
|
|
39
39
|
FunctionType.AVG: lambda args: f"{args[0]}",
|
|
40
40
|
}
|
trilogy/parsing/parse_engine.py
CHANGED
|
@@ -1464,7 +1464,7 @@ class ParseToObjects(Transformer):
|
|
|
1464
1464
|
return DatePart(args.value)
|
|
1465
1465
|
|
|
1466
1466
|
@v_args(meta=True)
|
|
1467
|
-
def window_item(self, meta, args) -> WindowItem:
|
|
1467
|
+
def window_item(self, meta: Meta, args) -> WindowItem:
|
|
1468
1468
|
type: WindowType = args[0]
|
|
1469
1469
|
order_by = []
|
|
1470
1470
|
over = []
|
|
@@ -1486,7 +1486,10 @@ class ParseToObjects(Transformer):
|
|
|
1486
1486
|
else:
|
|
1487
1487
|
concept = arbitrary_to_concept(item, environment=self.environment)
|
|
1488
1488
|
self.environment.add_concept(concept, meta=meta)
|
|
1489
|
-
|
|
1489
|
+
if not concept:
|
|
1490
|
+
raise ParseError(
|
|
1491
|
+
f"Window statements must be on fields, not constants - error in: `{self.text_lookup[self.parse_address][meta.start_pos:meta.end_pos]}`"
|
|
1492
|
+
)
|
|
1490
1493
|
return WindowItem(
|
|
1491
1494
|
type=type,
|
|
1492
1495
|
content=concept.reference,
|
|
@@ -1815,16 +1818,24 @@ class ParseToObjects(Transformer):
|
|
|
1815
1818
|
return self.function_factory.create_function(args, FunctionType.BOOL, meta)
|
|
1816
1819
|
|
|
1817
1820
|
|
|
1818
|
-
def unpack_visit_error(e: VisitError):
|
|
1821
|
+
def unpack_visit_error(e: VisitError, text: str | None = None):
|
|
1819
1822
|
"""This is required to get exceptions from imports, which would
|
|
1820
1823
|
raise nested VisitErrors"""
|
|
1821
1824
|
if isinstance(e.orig_exc, VisitError):
|
|
1822
|
-
unpack_visit_error(e.orig_exc)
|
|
1825
|
+
unpack_visit_error(e.orig_exc, text)
|
|
1823
1826
|
elif isinstance(e.orig_exc, (UndefinedConceptException, ImportError)):
|
|
1824
1827
|
raise e.orig_exc
|
|
1825
1828
|
elif isinstance(e.orig_exc, (SyntaxError, TypeError)):
|
|
1826
1829
|
if isinstance(e.obj, Tree):
|
|
1827
|
-
|
|
1830
|
+
if text:
|
|
1831
|
+
extract = text[e.obj.meta.start_pos - 5 : e.obj.meta.end_pos + 5]
|
|
1832
|
+
raise InvalidSyntaxException(
|
|
1833
|
+
str(e.orig_exc)
|
|
1834
|
+
+ " in "
|
|
1835
|
+
+ str(e.rule)
|
|
1836
|
+
+ f" Line: {e.obj.meta.line} ({extract})"
|
|
1837
|
+
)
|
|
1838
|
+
InvalidSyntaxException(
|
|
1828
1839
|
str(e.orig_exc) + " in " + str(e.rule) + f" Line: {e.obj.meta.line}"
|
|
1829
1840
|
)
|
|
1830
1841
|
raise InvalidSyntaxException(str(e.orig_exc)).with_traceback(
|
|
@@ -1875,7 +1886,7 @@ def parse_text(
|
|
|
1875
1886
|
f"Parse time: {end - start} for {len(text)} characters, {len(output)} objects"
|
|
1876
1887
|
)
|
|
1877
1888
|
except VisitError as e:
|
|
1878
|
-
unpack_visit_error(e)
|
|
1889
|
+
unpack_visit_error(e, text)
|
|
1879
1890
|
# this will never be reached
|
|
1880
1891
|
raise e
|
|
1881
1892
|
except (
|
|
@@ -1886,6 +1897,12 @@ def parse_text(
|
|
|
1886
1897
|
ValidationError,
|
|
1887
1898
|
TypeError,
|
|
1888
1899
|
) as e:
|
|
1900
|
+
if isinstance(
|
|
1901
|
+
e, (UnexpectedCharacters, UnexpectedEOF, UnexpectedInput, UnexpectedToken)
|
|
1902
|
+
):
|
|
1903
|
+
raise InvalidSyntaxException(
|
|
1904
|
+
str(e) + "\nContext:\n" + e.get_context(text.replace("\n", " "), 20)
|
|
1905
|
+
)
|
|
1889
1906
|
raise InvalidSyntaxException(str(e))
|
|
1890
1907
|
|
|
1891
1908
|
return environment, output
|
|
File without changes
|
|
File without changes
|
|
File without changes
|