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

Files changed (39) hide show
  1. {pytrilogy-0.0.3.55.dist-info → pytrilogy-0.0.3.57.dist-info}/METADATA +1 -1
  2. {pytrilogy-0.0.3.55.dist-info → pytrilogy-0.0.3.57.dist-info}/RECORD +39 -34
  3. {pytrilogy-0.0.3.55.dist-info → pytrilogy-0.0.3.57.dist-info}/WHEEL +1 -1
  4. trilogy/__init__.py +1 -1
  5. trilogy/authoring/__init__.py +12 -1
  6. trilogy/core/enums.py +1 -0
  7. trilogy/core/models/author.py +6 -4
  8. trilogy/core/models/execute.py +4 -1
  9. trilogy/core/optimization.py +4 -4
  10. trilogy/core/processing/concept_strategies_v3.py +324 -895
  11. trilogy/core/processing/discovery_loop.py +0 -0
  12. trilogy/core/processing/discovery_node_factory.py +475 -0
  13. trilogy/core/processing/discovery_utility.py +123 -0
  14. trilogy/core/processing/discovery_validation.py +155 -0
  15. trilogy/core/processing/node_generators/basic_node.py +29 -11
  16. trilogy/core/processing/node_generators/node_merge_node.py +1 -1
  17. trilogy/core/processing/node_generators/select_node.py +6 -8
  18. trilogy/core/processing/node_generators/synonym_node.py +2 -1
  19. trilogy/core/processing/node_generators/unnest_node.py +7 -1
  20. trilogy/core/processing/nodes/__init__.py +2 -4
  21. trilogy/core/processing/nodes/base_node.py +0 -13
  22. trilogy/core/processing/nodes/group_node.py +1 -1
  23. trilogy/core/processing/utility.py +38 -11
  24. trilogy/core/query_processor.py +3 -3
  25. trilogy/core/statements/author.py +6 -2
  26. trilogy/core/statements/execute.py +3 -2
  27. trilogy/dialect/base.py +3 -30
  28. trilogy/dialect/snowflake.py +1 -1
  29. trilogy/executor.py +13 -4
  30. trilogy/parsing/common.py +1 -3
  31. trilogy/parsing/parse_engine.py +14 -2
  32. trilogy/parsing/trilogy.lark +1 -1
  33. trilogy/std/date.preql +3 -1
  34. trilogy/std/geography.preql +4 -0
  35. trilogy/std/money.preql +65 -4
  36. trilogy/std/net.preql +8 -0
  37. {pytrilogy-0.0.3.55.dist-info → pytrilogy-0.0.3.57.dist-info}/entry_points.txt +0 -0
  38. {pytrilogy-0.0.3.55.dist-info → pytrilogy-0.0.3.57.dist-info}/licenses/LICENSE.md +0 -0
  39. {pytrilogy-0.0.3.55.dist-info → pytrilogy-0.0.3.57.dist-info}/top_level.txt +0 -0
@@ -74,6 +74,7 @@ from trilogy.core.models.author import (
74
74
  Parenthetical,
75
75
  RowsetItem,
76
76
  SubselectComparison,
77
+ UndefinedConceptFull,
77
78
  WhereClause,
78
79
  Window,
79
80
  WindowItem,
@@ -666,8 +667,14 @@ class ParseToObjects(Transformer):
666
667
  environment=self.environment,
667
668
  metadata=metadata,
668
669
  )
669
-
670
- if purpose and purpose != Purpose.AUTO and concept.purpose != purpose:
670
+ # let constant purposes exist to support round-tripping
671
+ # as a build concept may end up with a constant based on constant inlining happening recursively
672
+ if (
673
+ purpose
674
+ and purpose != Purpose.AUTO
675
+ and concept.purpose != purpose
676
+ and purpose != Purpose.CONSTANT
677
+ ):
671
678
  raise SyntaxError(
672
679
  f'Concept {name} purpose {concept.purpose} does not match declared purpose {purpose}. Suggest defaulting to "auto"'
673
680
  )
@@ -962,6 +969,11 @@ class ParseToObjects(Transformer):
962
969
  targets = {sources[0].address: self.environment.concepts[target]}
963
970
 
964
971
  if self.parse_pass == ParsePass.VALIDATION:
972
+ for source_c in sources:
973
+ if isinstance(source_c, UndefinedConceptFull):
974
+ raise SyntaxError(
975
+ f"Cannot merge non-existent source concept {source_c.address} on line: {meta.line}"
976
+ )
965
977
  new = MergeStatementV2(
966
978
  sources=sources,
967
979
  targets=targets,
@@ -379,7 +379,7 @@
379
379
 
380
380
  int_lit: /\-?[0-9]+/
381
381
 
382
- float_lit: /[0-9]*\.[0-9]+/
382
+ float_lit: /\-?[0-9]*\.[0-9]+/
383
383
 
384
384
  array_lit: "[" (literal ",")* literal ","? "]"()
385
385
 
trilogy/std/date.preql CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  type year int;
4
4
  type month int;
5
+ type week int;
5
6
  type day int;
6
7
  type hour int;
7
8
  type minute int;
8
- type second int;
9
+ type second int;
10
+ type day_of_week int;
@@ -15,3 +15,7 @@ type city string; # City name
15
15
  type country string; # Country name
16
16
  type timezone string; # Timezone name
17
17
  type region string; # Region name
18
+
19
+
20
+ ## special formats
21
+ type geojson string; # GeoJSON format for geographic data
trilogy/std/money.preql CHANGED
@@ -1,6 +1,67 @@
1
+ # generic currency types
1
2
 
3
+ # Major global currencies
4
+ type usd numeric; # US Dollar
5
+ type eur numeric; # Euro
6
+ type gbp numeric; # British Pound Sterling
7
+ type jpy numeric; # Japanese Yen
8
+ type chf numeric; # Swiss Franc
9
+ type cad numeric; # Canadian Dollar
10
+ type aud numeric; # Australian Dollar
11
+ type nzd numeric; # New Zealand Dollar
2
12
 
3
- # generic currency types
4
- type usd numeric;
5
- type eur numeric;
6
- type gbp numeric;
13
+ # Asian currencies
14
+ type cny numeric; # Chinese Yuan
15
+ type hkd numeric; # Hong Kong Dollar
16
+ type sgd numeric; # Singapore Dollar
17
+ type krw numeric; # South Korean Won
18
+ type inr numeric; # Indian Rupee
19
+ type thb numeric; # Thai Baht
20
+ type php numeric; # Philippine Peso
21
+ type myr numeric; # Malaysian Ringgit
22
+ type idr numeric; # Indonesian Rupiah
23
+ type vnd numeric; # Vietnamese Dong
24
+
25
+ # European currencies (non-Euro)
26
+ type sek numeric; # Swedish Krona
27
+ type nok numeric; # Norwegian Krone
28
+ type dkk numeric; # Danish Krone
29
+ type pln numeric; # Polish Zloty
30
+ type czk numeric; # Czech Koruna
31
+ type huf numeric; # Hungarian Forint
32
+ type ron numeric; # Romanian Leu
33
+ type bgn numeric; # Bulgarian Lev
34
+ type rub numeric; # Russian Ruble
35
+
36
+ # Middle Eastern currencies
37
+ type aed numeric; # UAE Dirham
38
+ type sar numeric; # Saudi Riyal
39
+ type qar numeric; # Qatari Riyal
40
+ type kwd numeric; # Kuwaiti Dinar
41
+ type bhd numeric; # Bahraini Dinar
42
+ type omr numeric; # Omani Rial
43
+ type jod numeric; # Jordanian Dinar
44
+ type ils numeric; # Israeli Shekel
45
+ type try numeric; # Turkish Lira
46
+
47
+ # African currencies
48
+ type zar numeric; # South African Rand
49
+ type egp numeric; # Egyptian Pound
50
+ type ngn numeric; # Nigerian Naira
51
+ type mad numeric; # Moroccan Dirham
52
+ type kes numeric; # Kenyan Shilling
53
+ type ghs numeric; # Ghanaian Cedi
54
+
55
+ # Latin American currencies
56
+ type mxn numeric; # Mexican Peso
57
+ type brl numeric; # Brazilian Real
58
+ type ars numeric; # Argentine Peso
59
+ type cop numeric; # Colombian Peso
60
+ type pen numeric; # Peruvian Sol
61
+ type clp numeric; # Chilean Peso
62
+ type uyu numeric; # Uruguayan Peso
63
+
64
+ # Other notable currencies
65
+ type isk numeric; # Icelandic Krona
66
+ type xof numeric; # West African CFA Franc
67
+ type xaf numeric; # Central African CFA Franc
trilogy/std/net.preql ADDED
@@ -0,0 +1,8 @@
1
+
2
+
3
+ type url string;
4
+ type domain string;
5
+ type ip_net_mask string;
6
+ type ipv6_address string;
7
+ type ipv4_address string;
8
+ type suffix string;