pytrilogy 0.0.3.57__tar.gz → 0.0.3.60__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.
- {pytrilogy-0.0.3.57/pytrilogy.egg-info → pytrilogy-0.0.3.60}/PKG-INFO +1 -1
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60/pytrilogy.egg-info}/PKG-INFO +1 -1
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/pytrilogy.egg-info/SOURCES.txt +1 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/__init__.py +1 -1
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/constants.py +1 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/enums.py +1 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/discovery_node_factory.py +1 -1
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/node_merge_node.py +15 -7
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/dialect/base.py +18 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/dialect/bigquery.py +2 -2
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/dialect/common.py +10 -4
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/parsing/common.py +7 -2
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/std/date.preql +4 -1
- pytrilogy-0.0.3.60/trilogy/std/ranking.preql +6 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/LICENSE.md +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/README.md +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/pyproject.toml +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/pytrilogy.egg-info/dependency_links.txt +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/pytrilogy.egg-info/entry_points.txt +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/pytrilogy.egg-info/requires.txt +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/pytrilogy.egg-info/top_level.txt +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/setup.cfg +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/setup.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_datatypes.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_declarations.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_derived_concepts.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_discovery_nodes.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_enums.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_environment.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_executor.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_failure.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_functions.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_imports.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_metadata.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_models.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_multi_join_assignments.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_parse_engine.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_parsing.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_parsing_failures.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_partial_handling.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_query_processing.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_query_render.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_select.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_show.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_statements.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_typing.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_undefined_concept.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_user_functions.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/tests/test_where_clause.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/authoring/__init__.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/compiler.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/constants.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/__init__.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/env_processor.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/environment_helpers.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/ergonomics.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/exceptions.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/functions.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/graph_models.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/internal.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/models/__init__.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/models/author.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/models/build.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/models/build_environment.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/models/core.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/models/datasource.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/models/environment.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/models/execute.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/optimization.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/optimizations/__init__.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/optimizations/base_optimization.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/optimizations/inline_datasource.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/optimizations/predicate_pushdown.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/__init__.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/concept_strategies_v3.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/discovery_loop.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/discovery_utility.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/discovery_validation.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/graph_utils.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/__init__.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/basic_node.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/common.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/filter_node.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/group_node.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/group_to_node.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/multiselect_node.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/recursive_node.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/rowset_node.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/select_helpers/__init__.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/select_helpers/datasource_injection.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/select_merge_node.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/select_node.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/synonym_node.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/union_node.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/unnest_node.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/window_node.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/nodes/__init__.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/nodes/base_node.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/nodes/filter_node.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/nodes/group_node.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/nodes/merge_node.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/nodes/recursive_node.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/nodes/select_node_v2.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/nodes/union_node.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/nodes/unnest_node.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/nodes/window_node.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/utility.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/query_processor.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/statements/__init__.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/statements/author.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/statements/build.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/statements/common.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/statements/execute.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/utility.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/dialect/__init__.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/dialect/config.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/dialect/dataframe.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/dialect/duckdb.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/dialect/enums.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/dialect/postgres.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/dialect/presto.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/dialect/snowflake.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/dialect/sql_server.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/engine.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/executor.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/hooks/__init__.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/hooks/base_hook.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/hooks/graph_hook.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/hooks/query_debugger.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/metadata/__init__.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/parser.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/parsing/__init__.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/parsing/config.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/parsing/exceptions.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/parsing/helpers.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/parsing/parse_engine.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/parsing/render.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/parsing/trilogy.lark +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/py.typed +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/render.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/scripts/__init__.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/scripts/trilogy.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/std/__init__.py +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/std/display.preql +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/std/geography.preql +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/std/money.preql +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/std/net.preql +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/std/report.preql +0 -0
- {pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/utility.py +0 -0
|
@@ -373,7 +373,7 @@ class RootNodeHandler:
|
|
|
373
373
|
) -> Optional[StrategyNode]:
|
|
374
374
|
logger.info(
|
|
375
375
|
f"{depth_to_prefix(self.ctx.depth)}{LOGGER_PREFIX} "
|
|
376
|
-
f"Could not resolve root concepts, checking for synonyms"
|
|
376
|
+
f"Could not resolve root concepts, checking for synonyms for {root_targets}"
|
|
377
377
|
)
|
|
378
378
|
|
|
379
379
|
if not self.ctx.history.check_started(
|
{pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/node_merge_node.py
RENAMED
|
@@ -88,7 +88,10 @@ def determine_induced_minimal_nodes(
|
|
|
88
88
|
for node in G.nodes:
|
|
89
89
|
if concepts.get(node):
|
|
90
90
|
lookup: BuildConcept = concepts[node]
|
|
91
|
-
|
|
91
|
+
# inclusion of aggregates can create ambiguous node relation chains
|
|
92
|
+
# there may be a better way to handle this
|
|
93
|
+
# can be revisited if we need to connect a derived synonym based on an aggregate
|
|
94
|
+
if lookup.derivation in (Derivation.CONSTANT, Derivation.AGGREGATE):
|
|
92
95
|
nodes_to_remove.append(node)
|
|
93
96
|
# purge a node if we're already looking for all it's parents
|
|
94
97
|
if filter_downstream and lookup.derivation not in (Derivation.ROOT,):
|
|
@@ -112,6 +115,7 @@ def determine_induced_minimal_nodes(
|
|
|
112
115
|
return None
|
|
113
116
|
H.remove_nodes_from(list(x for x in H.nodes if x not in paths))
|
|
114
117
|
sG: nx.Graph = ax.steinertree.steiner_tree(H, nodelist).copy()
|
|
118
|
+
logger.debug("Steiner tree found for nodes %s", nodelist)
|
|
115
119
|
final: nx.DiGraph = nx.subgraph(G, sG.nodes).copy()
|
|
116
120
|
|
|
117
121
|
for edge in G.edges:
|
|
@@ -228,11 +232,14 @@ def resolve_weak_components(
|
|
|
228
232
|
# to ensure there are not ambiguous discovery paths
|
|
229
233
|
# (if we did not care about raising ambiguity errors, we could just use the first one)
|
|
230
234
|
count = 0
|
|
231
|
-
node_list =
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
235
|
+
node_list = sorted(
|
|
236
|
+
[
|
|
237
|
+
concept_to_node(c.with_default_grain())
|
|
238
|
+
for c in all_concepts
|
|
239
|
+
if "__preql_internal" not in c.address
|
|
240
|
+
]
|
|
241
|
+
)
|
|
242
|
+
logger.debug(f"Resolving weak components for {node_list} in {search_graph.nodes}")
|
|
236
243
|
synonyms: set[str] = set()
|
|
237
244
|
for x in all_concepts:
|
|
238
245
|
synonyms = synonyms.union(x.pseudonyms)
|
|
@@ -354,7 +361,7 @@ def subgraphs_to_merge_node(
|
|
|
354
361
|
parents.append(parent)
|
|
355
362
|
input_c = []
|
|
356
363
|
for x in parents:
|
|
357
|
-
for y in x.
|
|
364
|
+
for y in x.usable_outputs:
|
|
358
365
|
input_c.append(y)
|
|
359
366
|
if len(parents) == 1 and enable_early_exit:
|
|
360
367
|
logger.info(
|
|
@@ -392,6 +399,7 @@ def gen_merge_node(
|
|
|
392
399
|
)
|
|
393
400
|
else:
|
|
394
401
|
all_search_concepts = all_concepts
|
|
402
|
+
all_search_concepts = sorted(all_search_concepts, key=lambda x: x.address)
|
|
395
403
|
for filter_downstream in [True, False]:
|
|
396
404
|
weak_resolve = resolve_weak_components(
|
|
397
405
|
all_search_concepts,
|
|
@@ -10,6 +10,7 @@ from trilogy.constants import (
|
|
|
10
10
|
Rendering,
|
|
11
11
|
logger,
|
|
12
12
|
)
|
|
13
|
+
from trilogy.core.constants import UNNEST_NAME
|
|
13
14
|
from trilogy.core.enums import (
|
|
14
15
|
DatePart,
|
|
15
16
|
FunctionType,
|
|
@@ -756,6 +757,16 @@ class BaseDialect:
|
|
|
756
757
|
f"{self.QUOTE_CHARACTER}{c.safe_address}{self.QUOTE_CHARACTER}"
|
|
757
758
|
for c in cte.join_derived_concepts
|
|
758
759
|
]
|
|
760
|
+
elif self.UNNEST_MODE == UnnestMode.CROSS_JOIN_UNNEST:
|
|
761
|
+
select_columns = [
|
|
762
|
+
self.render_concept_sql(c, cte)
|
|
763
|
+
for c in cte.output_columns
|
|
764
|
+
if c.address not in [y.address for y in cte.join_derived_concepts]
|
|
765
|
+
and c.address not in cte.hidden_concepts
|
|
766
|
+
] + [
|
|
767
|
+
f"{UNNEST_NAME} as {self.QUOTE_CHARACTER}{c.safe_address}{self.QUOTE_CHARACTER}"
|
|
768
|
+
for c in cte.join_derived_concepts
|
|
769
|
+
]
|
|
759
770
|
else:
|
|
760
771
|
# otherwse, assume we are unnesting directly in the select
|
|
761
772
|
select_columns = [
|
|
@@ -770,11 +781,18 @@ class BaseDialect:
|
|
|
770
781
|
if len(cte.joins) > 0:
|
|
771
782
|
if cte.join_derived_concepts and self.UNNEST_MODE in (
|
|
772
783
|
UnnestMode.CROSS_JOIN_ALIAS,
|
|
784
|
+
# UnnestMode.CROSS_JOIN_UNNEST,
|
|
773
785
|
UnnestMode.CROSS_JOIN,
|
|
774
786
|
UnnestMode.CROSS_APPLY,
|
|
775
787
|
):
|
|
776
788
|
|
|
777
789
|
source = f"{render_unnest(self.UNNEST_MODE, self.QUOTE_CHARACTER, cte.join_derived_concepts[0], self.render_expr, cte)}"
|
|
790
|
+
elif (
|
|
791
|
+
cte.join_derived_concepts
|
|
792
|
+
and self.UNNEST_MODE == UnnestMode.CROSS_JOIN_UNNEST
|
|
793
|
+
):
|
|
794
|
+
source = f"{self.render_expr(cte.join_derived_concepts[0], cte)} as {self.QUOTE_CHARACTER}{UNNEST_NAME}{self.QUOTE_CHARACTER}"
|
|
795
|
+
|
|
778
796
|
elif (
|
|
779
797
|
cte.join_derived_concepts
|
|
780
798
|
and self.UNNEST_MODE == UnnestMode.SNOWFLAKE
|
|
@@ -22,7 +22,7 @@ FUNCTION_MAP = {
|
|
|
22
22
|
FunctionType.MINUTE: lambda x: f"EXTRACT(MINUTE from {x[0]})",
|
|
23
23
|
FunctionType.SECOND: lambda x: f"EXTRACT(SECOND from {x[0]})",
|
|
24
24
|
FunctionType.HOUR: lambda x: f"EXTRACT(HOUR from {x[0]})",
|
|
25
|
-
FunctionType.DAY_OF_WEEK: lambda x: f"EXTRACT(DAYOFWEEK from {x[0]})",
|
|
25
|
+
FunctionType.DAY_OF_WEEK: lambda x: f"EXTRACT(DAYOFWEEK from {x[0]})-1", # BigQuery's DAYOFWEEK returns 1 for Sunday
|
|
26
26
|
FunctionType.DAY: lambda x: f"EXTRACT(DAY from {x[0]})",
|
|
27
27
|
FunctionType.YEAR: lambda x: f"EXTRACT(YEAR from {x[0]})",
|
|
28
28
|
FunctionType.MONTH: lambda x: f"EXTRACT(MONTH from {x[0]})",
|
|
@@ -97,5 +97,5 @@ class BigqueryDialect(BaseDialect):
|
|
|
97
97
|
}
|
|
98
98
|
QUOTE_CHARACTER = "`"
|
|
99
99
|
SQL_TEMPLATE = BQ_SQL_TEMPLATE
|
|
100
|
-
UNNEST_MODE = UnnestMode.
|
|
100
|
+
UNNEST_MODE = UnnestMode.CROSS_JOIN_UNNEST
|
|
101
101
|
DATATYPE_MAP = DATATYPE_MAP
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from typing import Callable
|
|
2
2
|
|
|
3
|
+
from trilogy.core.constants import UNNEST_NAME
|
|
3
4
|
from trilogy.core.enums import Modifier, UnnestMode
|
|
4
5
|
from trilogy.core.models.build import (
|
|
5
6
|
BuildComparison,
|
|
@@ -34,11 +35,14 @@ def render_unnest(
|
|
|
34
35
|
cte: CTE,
|
|
35
36
|
):
|
|
36
37
|
if not isinstance(concept, (BuildConcept, BuildParamaterizedConceptReference)):
|
|
37
|
-
|
|
38
|
+
print(type(concept))
|
|
39
|
+
address = UNNEST_NAME
|
|
38
40
|
else:
|
|
39
41
|
address = concept.safe_address
|
|
40
42
|
if unnest_mode == UnnestMode.CROSS_JOIN:
|
|
41
43
|
return f"{render_func(concept, cte)} as {quote_character}{address}{quote_character}"
|
|
44
|
+
elif unnest_mode == UnnestMode.CROSS_JOIN_UNNEST:
|
|
45
|
+
return f"unnest({render_func(concept, cte)}) as {quote_character}{address}{quote_character}"
|
|
42
46
|
elif unnest_mode == UnnestMode.CROSS_JOIN_ALIAS:
|
|
43
47
|
return f"{render_func(concept, cte)} as unnest_wrapper ({quote_character}{address}{quote_character})"
|
|
44
48
|
elif unnest_mode == UnnestMode.SNOWFLAKE:
|
|
@@ -95,9 +99,11 @@ def render_join(
|
|
|
95
99
|
return None
|
|
96
100
|
if not cte:
|
|
97
101
|
raise ValueError("must provide a cte to build an unnest joins")
|
|
98
|
-
if unnest_mode
|
|
99
|
-
|
|
100
|
-
|
|
102
|
+
if unnest_mode in (
|
|
103
|
+
UnnestMode.CROSS_JOIN,
|
|
104
|
+
UnnestMode.CROSS_JOIN_UNNEST,
|
|
105
|
+
UnnestMode.CROSS_JOIN_ALIAS,
|
|
106
|
+
):
|
|
101
107
|
return f"CROSS JOIN {render_unnest(unnest_mode, quote_character, join.object_to_unnest, render_expr_func, cte)}"
|
|
102
108
|
if unnest_mode == UnnestMode.SNOWFLAKE:
|
|
103
109
|
return f"LEFT JOIN LATERAL {render_unnest(unnest_mode, quote_character, join.object_to_unnest, render_expr_func, cte)}"
|
|
@@ -38,6 +38,7 @@ from trilogy.core.models.author import (
|
|
|
38
38
|
Parenthetical,
|
|
39
39
|
RowsetItem,
|
|
40
40
|
RowsetLineage,
|
|
41
|
+
TraitDataType,
|
|
41
42
|
UndefinedConcept,
|
|
42
43
|
WhereClause,
|
|
43
44
|
WindowItem,
|
|
@@ -608,6 +609,9 @@ def window_item_to_concept(
|
|
|
608
609
|
and set([x.address for x in item.expr.by]) == keys
|
|
609
610
|
):
|
|
610
611
|
continue
|
|
612
|
+
elif isinstance(item.expr, AggregateWrapper):
|
|
613
|
+
|
|
614
|
+
grain_components += item.expr.by
|
|
611
615
|
else:
|
|
612
616
|
grain_components += item.concept_arguments
|
|
613
617
|
else:
|
|
@@ -617,19 +621,20 @@ def window_item_to_concept(
|
|
|
617
621
|
modifiers = get_upstream_modifiers(bcontent.concept_arguments, environment)
|
|
618
622
|
datatype = parent.content.datatype
|
|
619
623
|
if parent.type in (
|
|
620
|
-
WindowType.RANK,
|
|
624
|
+
# WindowType.RANK,
|
|
621
625
|
WindowType.ROW_NUMBER,
|
|
622
626
|
WindowType.COUNT,
|
|
623
627
|
WindowType.COUNT_DISTINCT,
|
|
624
628
|
):
|
|
625
629
|
datatype = DataType.INTEGER
|
|
630
|
+
if parent.type == WindowType.RANK:
|
|
631
|
+
datatype = TraitDataType(type=DataType.INTEGER, traits=["rank"])
|
|
626
632
|
return Concept(
|
|
627
633
|
name=name,
|
|
628
634
|
datatype=datatype,
|
|
629
635
|
purpose=local_purpose,
|
|
630
636
|
lineage=parent,
|
|
631
637
|
metadata=fmetadata,
|
|
632
|
-
# filters are implicitly at the grain of the base item
|
|
633
638
|
grain=final_grain,
|
|
634
639
|
namespace=namespace,
|
|
635
640
|
keys=keys,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/__init__.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/basic_node.py
RENAMED
|
File without changes
|
|
File without changes
|
{pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/filter_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/group_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/group_to_node.py
RENAMED
|
File without changes
|
|
File without changes
|
{pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/recursive_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/rowset_node.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/select_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/synonym_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/union_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/unnest_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.57 → pytrilogy-0.0.3.60}/trilogy/core/processing/node_generators/window_node.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|