pytrilogy 0.0.1.108__tar.gz → 0.0.1.109__tar.gz

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 (99) hide show
  1. {pytrilogy-0.0.1.108/pytrilogy.egg-info → pytrilogy-0.0.1.109}/PKG-INFO +1 -1
  2. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109/pytrilogy.egg-info}/PKG-INFO +1 -1
  3. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/__init__.py +1 -1
  4. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/models.py +25 -7
  5. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/node_generators/common.py +1 -0
  6. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/node_generators/rowset_node.py +9 -3
  7. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/nodes/base_node.py +1 -0
  8. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/nodes/merge_node.py +1 -0
  9. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/parsing/parse_engine.py +4 -4
  10. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/LICENSE.md +0 -0
  11. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/README.md +0 -0
  12. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/pyproject.toml +0 -0
  13. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/pytrilogy.egg-info/SOURCES.txt +0 -0
  14. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/pytrilogy.egg-info/dependency_links.txt +0 -0
  15. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/pytrilogy.egg-info/entry_points.txt +0 -0
  16. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/pytrilogy.egg-info/requires.txt +0 -0
  17. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/pytrilogy.egg-info/top_level.txt +0 -0
  18. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/setup.cfg +0 -0
  19. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/setup.py +0 -0
  20. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/tests/test_declarations.py +0 -0
  21. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/tests/test_derived_concepts.py +0 -0
  22. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/tests/test_discovery_nodes.py +0 -0
  23. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/tests/test_environment.py +0 -0
  24. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/tests/test_functions.py +0 -0
  25. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/tests/test_imports.py +0 -0
  26. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/tests/test_metadata.py +0 -0
  27. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/tests/test_models.py +0 -0
  28. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/tests/test_multi_join_assignments.py +0 -0
  29. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/tests/test_parsing.py +0 -0
  30. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/tests/test_partial_handling.py +0 -0
  31. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/tests/test_query_processing.py +0 -0
  32. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/tests/test_select.py +0 -0
  33. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/tests/test_statements.py +0 -0
  34. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/tests/test_undefined_concept.py +0 -0
  35. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/tests/test_where_clause.py +0 -0
  36. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/compiler.py +0 -0
  37. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/constants.py +0 -0
  38. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/__init__.py +0 -0
  39. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/constants.py +0 -0
  40. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/enums.py +0 -0
  41. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/env_processor.py +0 -0
  42. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/environment_helpers.py +0 -0
  43. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/ergonomics.py +0 -0
  44. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/exceptions.py +0 -0
  45. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/functions.py +0 -0
  46. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/graph_models.py +0 -0
  47. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/internal.py +0 -0
  48. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/optimization.py +0 -0
  49. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/__init__.py +0 -0
  50. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/concept_strategies_v3.py +0 -0
  51. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/graph_utils.py +0 -0
  52. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/node_generators/__init__.py +0 -0
  53. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/node_generators/basic_node.py +0 -0
  54. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/node_generators/concept_merge_node.py +0 -0
  55. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/node_generators/filter_node.py +0 -0
  56. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/node_generators/group_node.py +0 -0
  57. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/node_generators/group_to_node.py +0 -0
  58. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/node_generators/multiselect_node.py +0 -0
  59. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/node_generators/node_merge_node.py +0 -0
  60. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/node_generators/select_node.py +0 -0
  61. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/node_generators/unnest_node.py +0 -0
  62. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/node_generators/window_node.py +0 -0
  63. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/nodes/__init__.py +0 -0
  64. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/nodes/filter_node.py +0 -0
  65. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/nodes/group_node.py +0 -0
  66. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/nodes/select_node_v2.py +0 -0
  67. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/nodes/unnest_node.py +0 -0
  68. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/nodes/window_node.py +0 -0
  69. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/processing/utility.py +0 -0
  70. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/core/query_processor.py +0 -0
  71. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/dialect/__init__.py +0 -0
  72. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/dialect/base.py +0 -0
  73. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/dialect/bigquery.py +0 -0
  74. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/dialect/common.py +0 -0
  75. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/dialect/config.py +0 -0
  76. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/dialect/duckdb.py +0 -0
  77. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/dialect/enums.py +0 -0
  78. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/dialect/postgres.py +0 -0
  79. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/dialect/presto.py +0 -0
  80. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/dialect/snowflake.py +0 -0
  81. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/dialect/sql_server.py +0 -0
  82. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/engine.py +0 -0
  83. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/executor.py +0 -0
  84. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/hooks/__init__.py +0 -0
  85. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/hooks/base_hook.py +0 -0
  86. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/hooks/graph_hook.py +0 -0
  87. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/hooks/query_debugger.py +0 -0
  88. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/metadata/__init__.py +0 -0
  89. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/parser.py +0 -0
  90. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/parsing/__init__.py +0 -0
  91. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/parsing/common.py +0 -0
  92. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/parsing/config.py +0 -0
  93. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/parsing/exceptions.py +0 -0
  94. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/parsing/helpers.py +0 -0
  95. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/parsing/render.py +0 -0
  96. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/py.typed +0 -0
  97. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/scripts/__init__.py +0 -0
  98. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/scripts/trilogy.py +0 -0
  99. {pytrilogy-0.0.1.108 → pytrilogy-0.0.1.109}/trilogy/utility.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pytrilogy
3
- Version: 0.0.1.108
3
+ Version: 0.0.1.109
4
4
  Summary: Declarative, typed query language that compiles to SQL.
5
5
  Home-page:
6
6
  Author:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pytrilogy
3
- Version: 0.0.1.108
3
+ Version: 0.0.1.109
4
4
  Summary: Declarative, typed query language that compiles to SQL.
5
5
  Home-page:
6
6
  Author:
@@ -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.1.108"
7
+ __version__ = "0.0.1.109"
8
8
 
9
9
  __all__ = ["parse", "Executor", "Dialects", "Environment", "CONFIG"]
@@ -496,13 +496,31 @@ class Concept(Namespaced, SelectGrain, BaseModel):
496
496
  @property
497
497
  def sources(self) -> List["Concept"]:
498
498
  if self.lineage:
499
- output = []
500
- for item in self.lineage.arguments:
501
- if isinstance(item, Concept):
502
- if item.address == self.address:
503
- raise SyntaxError(f"Concept {self.address} references itself")
504
- output.append(item)
505
- output += item.sources
499
+ output: List[Concept] = []
500
+
501
+ def get_sources(
502
+ expr: Union[
503
+ Function,
504
+ WindowItem,
505
+ FilterItem,
506
+ AggregateWrapper,
507
+ RowsetItem,
508
+ MultiSelectStatement | MergeStatement,
509
+ ],
510
+ output: List[Concept],
511
+ ):
512
+ for item in expr.arguments:
513
+ if isinstance(item, Concept):
514
+ if item.address == self.address:
515
+ raise SyntaxError(
516
+ f"Concept {self.address} references itself"
517
+ )
518
+ output.append(item)
519
+ output += item.sources
520
+ elif isinstance(item, Function):
521
+ get_sources(item, output)
522
+
523
+ get_sources(self.lineage, output)
506
524
  return output
507
525
  return []
508
526
 
@@ -196,6 +196,7 @@ def gen_enrichment_node(
196
196
  log_lambda(
197
197
  f"{str(type(base_node).__name__)} returning merge node with group node + enrichment node"
198
198
  )
199
+
199
200
  return MergeNode(
200
201
  input_concepts=unique(
201
202
  join_keys + extra_required + base_node.output_concepts, "address"
@@ -10,7 +10,7 @@ from trilogy.core.processing.nodes import MergeNode, NodeJoin, History, Strategy
10
10
  from trilogy.core.processing.nodes.base_node import concept_list_to_grain
11
11
  from typing import List
12
12
 
13
- from trilogy.core.enums import JoinType
13
+ from trilogy.core.enums import JoinType, PurposeLineage
14
14
  from trilogy.constants import logger
15
15
  from trilogy.core.processing.utility import padding
16
16
  from trilogy.core.processing.node_generators.common import concept_to_relevant_joins
@@ -53,7 +53,7 @@ def gen_rowset_node(
53
53
  return None
54
54
  node.conditions = select.where_clause.conditional if select.where_clause else None
55
55
  # rebuild any cached info with the new condition clause
56
- node.rebuild_cache()
56
+
57
57
  enrichment = set([x.address for x in local_optional])
58
58
  rowset_relevant = [
59
59
  x
@@ -71,9 +71,15 @@ def gen_rowset_node(
71
71
  if select.where_clause:
72
72
  for item in additional_relevant:
73
73
  node.partial_concepts.append(item)
74
-
74
+ node.hidden_concepts = [
75
+ x
76
+ for x in node.output_concepts
77
+ if x.address not in [y.address for y in local_optional + [concept]]
78
+ and x.derivation != PurposeLineage.ROWSET
79
+ ]
75
80
  # assume grain to be output of select
76
81
  # but don't include anything aggregate at this point
82
+ node.rebuild_cache()
77
83
  assert node.resolution_cache
78
84
  node.resolution_cache.grain = concept_list_to_grain(
79
85
  node.output_concepts, parent_sources=node.resolution_cache.datasources
@@ -184,6 +184,7 @@ class StrategyNode:
184
184
 
185
185
  def rebuild_cache(self) -> QueryDatasource:
186
186
  self.tainted = True
187
+ self.output_lcl = LooseConceptList(concepts=self.output_concepts)
187
188
  if not self.resolution_cache:
188
189
  return self.resolve()
189
190
  self.resolution_cache = None
@@ -207,6 +207,7 @@ class MergeNode(StrategyNode):
207
207
  joins = self.translate_node_joins(final_joins)
208
208
  else:
209
209
  return []
210
+
210
211
  for join in joins:
211
212
  logger.info(
212
213
  f"{self.logging_prefix}{LOGGER_PREFIX} final join {join.join_type} {[str(c) for c in join.concepts]}"
@@ -981,13 +981,13 @@ class ParseToObjects(Transformer):
981
981
 
982
982
  @v_args(meta=True)
983
983
  def merge_statement(self, meta: Meta, args) -> MergeStatement:
984
-
985
984
  parsed = [self.environment.concepts[x] for x in args]
986
985
  datatypes = {x.datatype for x in parsed}
987
- if not len(datatypes) == 1:
986
+ if not len(datatypes) == 1 and self.environment.concepts.fail_on_missing:
987
+ type_dict = {x.address: x.datatype for x in parsed}
988
988
  raise SyntaxError(
989
- f"Cannot merge concepts with different datatypes {datatypes}"
990
- f"line: {meta.line} concepts: {[x.address for x in parsed]}"
989
+ f"Cannot merge concepts with different datatype"
990
+ f"line: {meta.line} concepts: {type_dict}"
991
991
  )
992
992
  merge = MergeStatement(concepts=parsed, datatype=datatypes.pop())
993
993
  new = merge.merge_concept
File without changes
File without changes
File without changes
File without changes