pytrilogy 0.0.3.55__tar.gz → 0.0.3.57__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.55/pytrilogy.egg-info → pytrilogy-0.0.3.57}/PKG-INFO +1 -1
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57/pytrilogy.egg-info}/PKG-INFO +1 -1
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/pytrilogy.egg-info/SOURCES.txt +5 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_discovery_nodes.py +10 -2
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_functions.py +17 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_user_functions.py +2 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/__init__.py +1 -1
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/authoring/__init__.py +12 -1
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/enums.py +1 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/models/author.py +6 -4
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/models/execute.py +4 -1
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/optimization.py +4 -4
- pytrilogy-0.0.3.57/trilogy/core/processing/concept_strategies_v3.py +593 -0
- pytrilogy-0.0.3.57/trilogy/core/processing/discovery_node_factory.py +475 -0
- pytrilogy-0.0.3.57/trilogy/core/processing/discovery_utility.py +123 -0
- pytrilogy-0.0.3.57/trilogy/core/processing/discovery_validation.py +155 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/node_generators/basic_node.py +29 -11
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/node_generators/node_merge_node.py +1 -1
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/node_generators/select_node.py +6 -8
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/node_generators/synonym_node.py +2 -1
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/node_generators/unnest_node.py +7 -1
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/nodes/__init__.py +2 -4
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/nodes/base_node.py +0 -13
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/nodes/group_node.py +1 -1
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/utility.py +38 -11
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/query_processor.py +3 -3
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/statements/author.py +6 -2
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/statements/execute.py +3 -2
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/dialect/base.py +3 -30
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/dialect/snowflake.py +1 -1
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/executor.py +13 -4
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/parsing/common.py +1 -3
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/parsing/parse_engine.py +14 -2
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/parsing/trilogy.lark +1 -1
- pytrilogy-0.0.3.57/trilogy/std/__init__.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/std/date.preql +3 -1
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/std/geography.preql +4 -0
- pytrilogy-0.0.3.57/trilogy/std/money.preql +67 -0
- pytrilogy-0.0.3.57/trilogy/std/net.preql +8 -0
- pytrilogy-0.0.3.55/trilogy/core/processing/concept_strategies_v3.py +0 -1164
- pytrilogy-0.0.3.55/trilogy/std/money.preql +0 -6
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/LICENSE.md +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/README.md +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/pyproject.toml +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/pytrilogy.egg-info/dependency_links.txt +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/pytrilogy.egg-info/entry_points.txt +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/pytrilogy.egg-info/requires.txt +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/pytrilogy.egg-info/top_level.txt +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/setup.cfg +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/setup.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_datatypes.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_declarations.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_derived_concepts.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_enums.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_environment.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_executor.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_failure.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_imports.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_metadata.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_models.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_multi_join_assignments.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_parse_engine.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_parsing.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_parsing_failures.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_partial_handling.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_query_processing.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_query_render.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_select.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_show.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_statements.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_typing.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_undefined_concept.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/tests/test_where_clause.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/compiler.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/constants.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/__init__.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/constants.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/env_processor.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/environment_helpers.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/ergonomics.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/exceptions.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/functions.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/graph_models.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/internal.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/models/__init__.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/models/build.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/models/build_environment.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/models/core.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/models/datasource.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/models/environment.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/optimizations/__init__.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/optimizations/base_optimization.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/optimizations/inline_datasource.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/optimizations/predicate_pushdown.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/__init__.py +0 -0
- /pytrilogy-0.0.3.55/trilogy/core/processing/node_generators/select_helpers/__init__.py → /pytrilogy-0.0.3.57/trilogy/core/processing/discovery_loop.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/graph_utils.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/node_generators/__init__.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/node_generators/common.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/node_generators/filter_node.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/node_generators/group_node.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/node_generators/group_to_node.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/node_generators/multiselect_node.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/node_generators/recursive_node.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/node_generators/rowset_node.py +0 -0
- {pytrilogy-0.0.3.55/trilogy/core/statements → pytrilogy-0.0.3.57/trilogy/core/processing/node_generators/select_helpers}/__init__.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/node_generators/select_helpers/datasource_injection.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/node_generators/select_merge_node.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/node_generators/union_node.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/node_generators/window_node.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/nodes/filter_node.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/nodes/merge_node.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/nodes/recursive_node.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/nodes/select_node_v2.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/nodes/union_node.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/nodes/unnest_node.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/processing/nodes/window_node.py +0 -0
- {pytrilogy-0.0.3.55/trilogy/dialect → pytrilogy-0.0.3.57/trilogy/core/statements}/__init__.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/statements/build.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/statements/common.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/core/utility.py +0 -0
- {pytrilogy-0.0.3.55/trilogy/metadata → pytrilogy-0.0.3.57/trilogy/dialect}/__init__.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/dialect/bigquery.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/dialect/common.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/dialect/config.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/dialect/dataframe.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/dialect/duckdb.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/dialect/enums.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/dialect/postgres.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/dialect/presto.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/dialect/sql_server.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/engine.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/hooks/__init__.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/hooks/base_hook.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/hooks/graph_hook.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/hooks/query_debugger.py +0 -0
- {pytrilogy-0.0.3.55/trilogy/parsing → pytrilogy-0.0.3.57/trilogy/metadata}/__init__.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/parser.py +0 -0
- {pytrilogy-0.0.3.55/trilogy/scripts → pytrilogy-0.0.3.57/trilogy/parsing}/__init__.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/parsing/config.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/parsing/exceptions.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/parsing/helpers.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/parsing/render.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/py.typed +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/render.py +0 -0
- {pytrilogy-0.0.3.55/trilogy/std → pytrilogy-0.0.3.57/trilogy/scripts}/__init__.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/scripts/trilogy.py +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/std/display.preql +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/std/report.preql +0 -0
- {pytrilogy-0.0.3.55 → pytrilogy-0.0.3.57}/trilogy/utility.py +0 -0
|
@@ -71,6 +71,10 @@ trilogy/core/optimizations/inline_datasource.py
|
|
|
71
71
|
trilogy/core/optimizations/predicate_pushdown.py
|
|
72
72
|
trilogy/core/processing/__init__.py
|
|
73
73
|
trilogy/core/processing/concept_strategies_v3.py
|
|
74
|
+
trilogy/core/processing/discovery_loop.py
|
|
75
|
+
trilogy/core/processing/discovery_node_factory.py
|
|
76
|
+
trilogy/core/processing/discovery_utility.py
|
|
77
|
+
trilogy/core/processing/discovery_validation.py
|
|
74
78
|
trilogy/core/processing/graph_utils.py
|
|
75
79
|
trilogy/core/processing/utility.py
|
|
76
80
|
trilogy/core/processing/node_generators/__init__.py
|
|
@@ -138,4 +142,5 @@ trilogy/std/date.preql
|
|
|
138
142
|
trilogy/std/display.preql
|
|
139
143
|
trilogy/std/geography.preql
|
|
140
144
|
trilogy/std/money.preql
|
|
145
|
+
trilogy/std/net.preql
|
|
141
146
|
trilogy/std/report.preql
|
|
@@ -51,7 +51,11 @@ def test_group_node_property(test_environment: Environment, test_environment_gra
|
|
|
51
51
|
for x in group_node.parents[0].output_concepts
|
|
52
52
|
if x not in group_node.parents[0].hidden_concepts
|
|
53
53
|
}
|
|
54
|
-
assert input_concept_names == {
|
|
54
|
+
assert input_concept_names == {
|
|
55
|
+
"category_name_length",
|
|
56
|
+
"category_name",
|
|
57
|
+
"category_id",
|
|
58
|
+
}
|
|
55
59
|
final = group_node.resolve()
|
|
56
60
|
assert len(final.datasources) == 1
|
|
57
61
|
assert final.datasources[0].group_required is False
|
|
@@ -79,7 +83,11 @@ def test_group_node_property_all(test_environment: Environment, test_environment
|
|
|
79
83
|
for x in group_node.parents[0].output_concepts
|
|
80
84
|
if x not in group_node.parents[0].hidden_concepts
|
|
81
85
|
}
|
|
82
|
-
assert input_concept_names == {
|
|
86
|
+
assert input_concept_names == {
|
|
87
|
+
"category_name_length",
|
|
88
|
+
"category_name",
|
|
89
|
+
"category_id",
|
|
90
|
+
}
|
|
83
91
|
final = group_node.resolve()
|
|
84
92
|
assert len(final.datasources) == 1
|
|
85
93
|
assert final.datasources[0].group_required is False
|
|
@@ -36,6 +36,23 @@ def test_typing():
|
|
|
36
36
|
assert x in set([x])
|
|
37
37
|
|
|
38
38
|
|
|
39
|
+
def test_negative_float_parsing(test_environment):
|
|
40
|
+
declarations = """
|
|
41
|
+
|
|
42
|
+
const x <- -1.23;
|
|
43
|
+
|
|
44
|
+
select
|
|
45
|
+
x
|
|
46
|
+
where x >-1.24;
|
|
47
|
+
|
|
48
|
+
"""
|
|
49
|
+
env, parsed = parse(declarations, environment=test_environment)
|
|
50
|
+
select: SelectStatement = parsed[-1]
|
|
51
|
+
|
|
52
|
+
for dialect in TEST_DIALECTS:
|
|
53
|
+
dialect.compile_statement(process_query(test_environment, select, hooks=[]))
|
|
54
|
+
|
|
55
|
+
|
|
39
56
|
def test_functions(test_environment):
|
|
40
57
|
declarations = """
|
|
41
58
|
|
|
@@ -208,7 +208,9 @@ auto test <-SUM(CASE WHEN 10 = weekday THEN x ELSE 0 END) +
|
|
|
208
208
|
def test_user_function_import():
|
|
209
209
|
env = Environment(working_path=Path(__file__).parent)
|
|
210
210
|
x = Dialects.DUCK_DB.default_executor(environment=env)
|
|
211
|
+
from trilogy.hooks import DebuggingHook
|
|
211
212
|
|
|
213
|
+
DebuggingHook()
|
|
212
214
|
results = x.execute_query(
|
|
213
215
|
"""
|
|
214
216
|
import test_env_functions as test_env_functions;
|
|
@@ -43,14 +43,19 @@ from trilogy.core.models.core import (
|
|
|
43
43
|
MapType,
|
|
44
44
|
StructType,
|
|
45
45
|
)
|
|
46
|
-
from trilogy.core.models.datasource import Datasource, DatasourceMetadata
|
|
46
|
+
from trilogy.core.models.datasource import Address, Datasource, DatasourceMetadata
|
|
47
47
|
from trilogy.core.models.environment import Environment
|
|
48
48
|
from trilogy.core.statements.author import (
|
|
49
49
|
ConceptDeclarationStatement,
|
|
50
50
|
ConceptTransform,
|
|
51
|
+
CopyStatement,
|
|
52
|
+
Grain,
|
|
53
|
+
HasUUID,
|
|
54
|
+
ImportStatement,
|
|
51
55
|
MultiSelectStatement,
|
|
52
56
|
PersistStatement,
|
|
53
57
|
RawSQLStatement,
|
|
58
|
+
RowsetDerivationStatement,
|
|
54
59
|
SelectItem,
|
|
55
60
|
SelectStatement,
|
|
56
61
|
)
|
|
@@ -73,6 +78,8 @@ __all__ = [
|
|
|
73
78
|
"DataType",
|
|
74
79
|
"StructType",
|
|
75
80
|
"ListType",
|
|
81
|
+
"Grain",
|
|
82
|
+
"RowsetDerivationStatement",
|
|
76
83
|
"MapType",
|
|
77
84
|
"ListWrapper",
|
|
78
85
|
"FunctionType",
|
|
@@ -109,4 +116,8 @@ __all__ = [
|
|
|
109
116
|
"MultiSelectLineage",
|
|
110
117
|
"RowsetItem",
|
|
111
118
|
"FunctionCallWrapper",
|
|
119
|
+
"CopyStatement",
|
|
120
|
+
"HasUUID",
|
|
121
|
+
"ImportStatement",
|
|
122
|
+
"Address",
|
|
112
123
|
]
|
|
@@ -1176,6 +1176,12 @@ class Concept(Addressable, DataTyped, ConceptArgs, Mergeable, Namespaced, BaseMo
|
|
|
1176
1176
|
and lineage.operator == FunctionType.UNION
|
|
1177
1177
|
):
|
|
1178
1178
|
return Derivation.UNION
|
|
1179
|
+
elif (
|
|
1180
|
+
lineage
|
|
1181
|
+
and isinstance(lineage, (BuildFunction, Function))
|
|
1182
|
+
and lineage.operator == FunctionType.GROUP
|
|
1183
|
+
):
|
|
1184
|
+
return Derivation.GROUP_TO
|
|
1179
1185
|
elif (
|
|
1180
1186
|
lineage
|
|
1181
1187
|
and isinstance(lineage, (BuildFunction, Function))
|
|
@@ -1195,10 +1201,6 @@ class Concept(Addressable, DataTyped, ConceptArgs, Mergeable, Namespaced, BaseMo
|
|
|
1195
1201
|
return Derivation.CONSTANT
|
|
1196
1202
|
return Derivation.ROOT
|
|
1197
1203
|
|
|
1198
|
-
# @property
|
|
1199
|
-
# def derivation(self) -> Derivation:
|
|
1200
|
-
# return self.calculate_derivation(self.lineage, self.purpose)
|
|
1201
|
-
|
|
1202
1204
|
@classmethod
|
|
1203
1205
|
def calculate_granularity(cls, derivation: Derivation, grain: Grain, lineage):
|
|
1204
1206
|
from trilogy.core.models.build import BuildFunction
|
|
@@ -658,18 +658,21 @@ class QueryDatasource(BaseModel):
|
|
|
658
658
|
@classmethod
|
|
659
659
|
def validate_source_map(cls, v: dict, info: ValidationInfo):
|
|
660
660
|
values = info.data
|
|
661
|
+
hidden_concepts = values.get("hidden_concepts", set())
|
|
661
662
|
for key in ("input_concepts", "output_concepts"):
|
|
662
663
|
if not values.get(key):
|
|
663
664
|
continue
|
|
664
665
|
concept: BuildConcept
|
|
665
666
|
for concept in values[key]:
|
|
667
|
+
if concept.address in hidden_concepts:
|
|
668
|
+
continue
|
|
666
669
|
if (
|
|
667
670
|
concept.address not in v
|
|
668
671
|
and not any(x in v for x in concept.pseudonyms)
|
|
669
672
|
and CONFIG.validate_missing
|
|
670
673
|
):
|
|
671
674
|
raise SyntaxError(
|
|
672
|
-
f"On query datasource missing source map for {concept.address} on {key} with pseudonyms {concept.pseudonyms}, have {v}"
|
|
675
|
+
f"On query datasource from {values} missing source map entry (map: {v}) for {concept.address} on {key} with pseudonyms {concept.pseudonyms}, have {v}"
|
|
673
676
|
)
|
|
674
677
|
return v
|
|
675
678
|
|
|
@@ -141,9 +141,7 @@ def is_direct_return_eligible(cte: CTE | UnionCTE) -> CTE | UnionCTE | None:
|
|
|
141
141
|
if not output_addresses.issubset(parent_output_addresses):
|
|
142
142
|
return None
|
|
143
143
|
if not direct_parent.grain == cte.grain:
|
|
144
|
-
logger.info("grain mismatch, cannot early exit")
|
|
145
|
-
logger.info(direct_parent.grain)
|
|
146
|
-
logger.info(cte.grain)
|
|
144
|
+
logger.info("[Direct Return] grain mismatch, cannot early exit")
|
|
147
145
|
return None
|
|
148
146
|
|
|
149
147
|
assert isinstance(cte, CTE)
|
|
@@ -236,6 +234,8 @@ def optimize_ctes(
|
|
|
236
234
|
complete = not actions_taken
|
|
237
235
|
loops += 1
|
|
238
236
|
input = reorder_ctes(filter_irrelevant_ctes(input, root_cte))
|
|
239
|
-
logger.info(
|
|
237
|
+
logger.info(
|
|
238
|
+
f"[Optimization] Finished checking for {type(rule).__name__} after {loops} loop(s)"
|
|
239
|
+
)
|
|
240
240
|
|
|
241
241
|
return reorder_ctes(filter_irrelevant_ctes(input, root_cte))
|