pytrilogy 0.0.3.119__tar.gz → 0.0.3.121__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.119/pytrilogy.egg-info → pytrilogy-0.0.3.121}/PKG-INFO +1 -1
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121/pytrilogy.egg-info}/PKG-INFO +1 -1
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_user_functions.py +35 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/__init__.py +1 -1
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/ai/conversation.py +3 -4
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/models/author.py +4 -9
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/models/environment.py +3 -2
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/discovery_utility.py +4 -4
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/nodes/base_node.py +5 -1
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/dialect/duckdb.py +1 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/parsing/parse_engine.py +1 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/LICENSE.md +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/README.md +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/pyproject.toml +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/pytrilogy.egg-info/SOURCES.txt +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/pytrilogy.egg-info/dependency_links.txt +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/pytrilogy.egg-info/entry_points.txt +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/pytrilogy.egg-info/requires.txt +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/pytrilogy.egg-info/top_level.txt +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/requirements.txt +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/setup.cfg +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_datatypes.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_declarations.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_derived_concepts.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_discovery_nodes.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_enums.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_environment.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_execute_models.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_executor.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_failure.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_functions.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_imports.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_metadata.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_models.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_multi_join_assignments.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_parse_engine.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_parsing.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_parsing_failures.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_partial_handling.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_query_processing.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_query_render.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_select.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_show.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_statements.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_typing.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_undefined_concept.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_validators.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/tests/test_where_clause.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/ai/__init__.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/ai/constants.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/ai/enums.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/ai/execute.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/ai/models.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/ai/prompts.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/ai/providers/__init__.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/ai/providers/anthropic.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/ai/providers/base.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/ai/providers/google.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/ai/providers/openai.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/ai/providers/utils.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/authoring/__init__.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/constants.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/__init__.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/constants.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/enums.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/env_processor.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/environment_helpers.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/ergonomics.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/exceptions.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/functions.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/graph_models.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/internal.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/models/__init__.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/models/build.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/models/build_environment.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/models/core.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/models/datasource.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/models/execute.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/optimization.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/optimizations/__init__.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/optimizations/base_optimization.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/optimizations/hide_unused_concept.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/optimizations/inline_datasource.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/optimizations/predicate_pushdown.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/__init__.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/concept_strategies_v3.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/discovery_node_factory.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/discovery_validation.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/graph_utils.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/__init__.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/basic_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/common.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/constant_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/filter_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/group_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/group_to_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/multiselect_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/node_merge_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/recursive_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/rowset_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/select_helpers/__init__.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/select_helpers/datasource_injection.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/select_merge_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/select_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/synonym_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/union_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/unnest_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/window_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/nodes/__init__.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/nodes/filter_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/nodes/group_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/nodes/merge_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/nodes/recursive_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/nodes/select_node_v2.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/nodes/union_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/nodes/unnest_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/nodes/window_node.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/utility.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/query_processor.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/statements/__init__.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/statements/author.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/statements/build.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/statements/common.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/statements/execute.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/utility.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/validation/__init__.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/validation/common.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/validation/concept.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/validation/datasource.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/validation/environment.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/validation/fix.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/dialect/__init__.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/dialect/base.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/dialect/bigquery.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/dialect/common.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/dialect/config.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/dialect/dataframe.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/dialect/enums.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/dialect/metadata.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/dialect/postgres.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/dialect/presto.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/dialect/snowflake.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/dialect/sql_server.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/engine.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/executor.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/hooks/__init__.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/hooks/base_hook.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/hooks/graph_hook.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/hooks/query_debugger.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/metadata/__init__.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/parser.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/parsing/__init__.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/parsing/common.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/parsing/config.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/parsing/exceptions.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/parsing/helpers.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/parsing/render.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/parsing/trilogy.lark +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/py.typed +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/render.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/scripts/__init__.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/scripts/trilogy.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/std/__init__.py +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/std/color.preql +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/std/date.preql +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/std/display.preql +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/std/geography.preql +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/std/metric.preql +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/std/money.preql +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/std/net.preql +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/std/ranking.preql +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/std/report.preql +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/std/semantic.preql +0 -0
- {pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/utility.py +0 -0
|
@@ -312,3 +312,38 @@ auto random <- @plus_two(@weekday_sales(10));
|
|
|
312
312
|
results = results.fetchall()
|
|
313
313
|
assert results[0].test2 == 10
|
|
314
314
|
assert results[1].test2 == 17
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
def test_user_function_aggregate_two():
|
|
318
|
+
x = Dialects.DUCK_DB.default_executor()
|
|
319
|
+
|
|
320
|
+
results = x.execute_query(
|
|
321
|
+
"""import std.geography;
|
|
322
|
+
import std.display;
|
|
323
|
+
|
|
324
|
+
key state string::us_state;
|
|
325
|
+
key year int;
|
|
326
|
+
property state.val string;
|
|
327
|
+
|
|
328
|
+
datasource states
|
|
329
|
+
(
|
|
330
|
+
state,
|
|
331
|
+
year,
|
|
332
|
+
val
|
|
333
|
+
)
|
|
334
|
+
grain (state, year)
|
|
335
|
+
query '''
|
|
336
|
+
select 'Vermont' as state, 2000 as year, 10 as val union all select 'Florida' as state, 2000, 5 as val
|
|
337
|
+
union all select 'Vermont', 2001, 16 union all select 'Florida' as state, 2001, 7
|
|
338
|
+
'''
|
|
339
|
+
;
|
|
340
|
+
|
|
341
|
+
def avg_year_percent_of_all_avg_year(field, dim)->round((avg(sum(field) by year, dim)/ avg(sum(field) by year )),2)::float::percent;
|
|
342
|
+
|
|
343
|
+
select @avg_year_percent_of_all_avg_year(val, state) as p_of_whole, state
|
|
344
|
+
order by p_of_whole desc;
|
|
345
|
+
"""
|
|
346
|
+
)
|
|
347
|
+
|
|
348
|
+
results = results.fetchall()
|
|
349
|
+
assert int(results[0].p_of_whole * 100) == 68
|
|
@@ -61,7 +61,7 @@ class Conversation:
|
|
|
61
61
|
if "```" in content:
|
|
62
62
|
parts = content.split("```")
|
|
63
63
|
if len(parts) >= 3:
|
|
64
|
-
return parts[
|
|
64
|
+
return parts[-2].strip()
|
|
65
65
|
return content
|
|
66
66
|
|
|
67
67
|
def generate_query(
|
|
@@ -78,7 +78,7 @@ class Conversation:
|
|
|
78
78
|
if not response.strip()[-1] == ";":
|
|
79
79
|
response += ";"
|
|
80
80
|
try:
|
|
81
|
-
|
|
81
|
+
_, raw = environment.parse(response)
|
|
82
82
|
process_query(statement=raw[-1], environment=environment)
|
|
83
83
|
return response
|
|
84
84
|
except (
|
|
@@ -90,10 +90,9 @@ class Conversation:
|
|
|
90
90
|
) as e2:
|
|
91
91
|
e = e2
|
|
92
92
|
self.add_message(
|
|
93
|
-
f"
|
|
93
|
+
f"Your extracted response - {response} - could not be parsed due to the error: {str(e)}. Please generate a new query with the issues fixed. Use the same response format.",
|
|
94
94
|
role="user",
|
|
95
95
|
)
|
|
96
|
-
|
|
97
96
|
raise Exception(
|
|
98
97
|
f"Failed to generate a valid query after {attempts} attempts. Last error: {str(e)}. Full conversation: {self.messages}"
|
|
99
98
|
)
|
|
@@ -162,14 +162,13 @@ class ConceptRef(Addressable, Namespaced, DataTyped, Mergeable, BaseModel):
|
|
|
162
162
|
)
|
|
163
163
|
|
|
164
164
|
def with_reference_replacement(self, source: str, target: Expr | ArgBinding):
|
|
165
|
-
if self.address == source:
|
|
166
|
-
return target
|
|
167
|
-
|
|
168
165
|
# a reference might be to an attribute of a struct that is bound late
|
|
169
166
|
# if the replacement is a parent in the access path; replace reference
|
|
170
167
|
# with an attribute access call
|
|
171
|
-
candidates = [f"
|
|
168
|
+
candidates = [f"{DEFAULT_NAMESPACE}.{self.address}", self.address]
|
|
172
169
|
for candidate in candidates:
|
|
170
|
+
if candidate == source:
|
|
171
|
+
return target
|
|
173
172
|
if not candidate.startswith(f"{source}."):
|
|
174
173
|
continue
|
|
175
174
|
attribute = self.address.rsplit(".", 1)[1]
|
|
@@ -2535,11 +2534,7 @@ class CustomFunctionFactory:
|
|
|
2535
2534
|
target = f"{DEFAULT_NAMESPACE}.{self.function_arguments[idx].name}"
|
|
2536
2535
|
else:
|
|
2537
2536
|
target = self.function_arguments[idx].name
|
|
2538
|
-
nout = (
|
|
2539
|
-
nout.with_reference_replacement(target, x)
|
|
2540
|
-
if isinstance(nout, Mergeable)
|
|
2541
|
-
else nout
|
|
2542
|
-
)
|
|
2537
|
+
nout = nout.with_reference_replacement(target, x)
|
|
2543
2538
|
return nout
|
|
2544
2539
|
|
|
2545
2540
|
|
|
@@ -215,7 +215,7 @@ class Environment(BaseModel):
|
|
|
215
215
|
functions: Dict[str, CustomFunctionFactory] = Field(default_factory=dict)
|
|
216
216
|
data_types: Dict[str, CustomType] = Field(default_factory=dict)
|
|
217
217
|
named_statements: Dict[str, SelectLineage] = Field(default_factory=dict)
|
|
218
|
-
imports:
|
|
218
|
+
imports: defaultdict[str, list[Import]] = Field(
|
|
219
219
|
default_factory=lambda: defaultdict(list) # type: ignore
|
|
220
220
|
)
|
|
221
221
|
namespace: str = DEFAULT_NAMESPACE
|
|
@@ -252,7 +252,7 @@ class Environment(BaseModel):
|
|
|
252
252
|
concepts=self.concepts.duplicate(),
|
|
253
253
|
functions=dict(self.functions),
|
|
254
254
|
data_types=dict(self.data_types),
|
|
255
|
-
imports=
|
|
255
|
+
imports=defaultdict(list, self.imports),
|
|
256
256
|
namespace=self.namespace,
|
|
257
257
|
working_path=self.working_path,
|
|
258
258
|
environment_config=self.config.model_copy(deep=True),
|
|
@@ -262,6 +262,7 @@ class Environment(BaseModel):
|
|
|
262
262
|
alias_origin_lookup={
|
|
263
263
|
k: v.duplicate() for k, v in self.alias_origin_lookup.items()
|
|
264
264
|
},
|
|
265
|
+
env_file_path=self.env_file_path,
|
|
265
266
|
)
|
|
266
267
|
|
|
267
268
|
def _add_path_concepts(self):
|
|
@@ -40,15 +40,15 @@ def calculate_effective_parent_grain(
|
|
|
40
40
|
pairs = join.concept_pairs or []
|
|
41
41
|
for key in pairs:
|
|
42
42
|
left = key.existing_datasource
|
|
43
|
-
logger.
|
|
43
|
+
logger.debug(f"adding left grain {left.grain} for join key {key.left}")
|
|
44
44
|
grain += left.grain
|
|
45
45
|
seen.add(left.name)
|
|
46
46
|
keys = [key.right for key in pairs]
|
|
47
47
|
join_grain = BuildGrain.from_concepts(keys)
|
|
48
48
|
if join_grain == join.right_datasource.grain:
|
|
49
|
-
logger.
|
|
49
|
+
logger.debug(f"irrelevant right join {join}, does not change grain")
|
|
50
50
|
else:
|
|
51
|
-
logger.
|
|
51
|
+
logger.debug(
|
|
52
52
|
f"join changes grain, adding {join.right_datasource.grain} to {grain}"
|
|
53
53
|
)
|
|
54
54
|
grain += join.right_datasource.grain
|
|
@@ -68,7 +68,7 @@ def calculate_effective_parent_grain(
|
|
|
68
68
|
]
|
|
69
69
|
)
|
|
70
70
|
):
|
|
71
|
-
logger.
|
|
71
|
+
logger.debug(f"adding unjoined grain {x.grain} for datasource {x.name}")
|
|
72
72
|
grain += x.grain
|
|
73
73
|
return grain
|
|
74
74
|
else:
|
|
@@ -258,10 +258,14 @@ class StrategyNode:
|
|
|
258
258
|
self.partial_lcl = LooseBuildConceptList(concepts=partials)
|
|
259
259
|
return partials
|
|
260
260
|
|
|
261
|
-
def add_output_concepts(
|
|
261
|
+
def add_output_concepts(
|
|
262
|
+
self, concepts: List[BuildConcept], rebuild: bool = True, unhide: bool = True
|
|
263
|
+
):
|
|
262
264
|
for concept in concepts:
|
|
263
265
|
if concept.address not in self.output_lcl.addresses:
|
|
264
266
|
self.output_concepts.append(concept)
|
|
267
|
+
if unhide and concept.address in self.hidden_concepts:
|
|
268
|
+
self.hidden_concepts.remove(concept.address)
|
|
265
269
|
self.output_lcl = LooseBuildConceptList(concepts=self.output_concepts)
|
|
266
270
|
if rebuild:
|
|
267
271
|
self.rebuild_cache()
|
|
@@ -104,6 +104,7 @@ FUNCTION_MAP = {
|
|
|
104
104
|
FunctionType.CONCAT: lambda x: f"({' || '.join(x)})",
|
|
105
105
|
FunctionType.DATE_LITERAL: lambda x: f"date '{x}'",
|
|
106
106
|
FunctionType.DATETIME_LITERAL: lambda x: f"datetime '{x}'",
|
|
107
|
+
FunctionType.DAY_OF_WEEK: lambda x: f"dayofweek({x[0]})",
|
|
107
108
|
# string
|
|
108
109
|
FunctionType.CONTAINS: lambda x: f"CONTAINS(LOWER({x[0]}), LOWER({x[1]}))",
|
|
109
110
|
# regexp
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/optimizations/hide_unused_concept.py
RENAMED
|
File without changes
|
|
File without changes
|
{pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/optimizations/predicate_pushdown.py
RENAMED
|
File without changes
|
|
File without changes
|
{pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/concept_strategies_v3.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/discovery_node_factory.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/__init__.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/basic_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/common.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/constant_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/filter_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/group_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/group_to_node.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/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.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/select_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/synonym_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/union_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/trilogy/core/processing/node_generators/unnest_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.119 → pytrilogy-0.0.3.121}/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
|
|
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
|