pytrilogy 0.0.3.30__tar.gz → 0.0.3.32__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 (139) hide show
  1. {pytrilogy-0.0.3.30/pytrilogy.egg-info → pytrilogy-0.0.3.32}/PKG-INFO +1 -1
  2. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32/pytrilogy.egg-info}/PKG-INFO +1 -1
  3. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/pytrilogy.egg-info/SOURCES.txt +1 -0
  4. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_environment.py +57 -0
  5. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/__init__.py +1 -1
  6. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/enums.py +2 -0
  7. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/environment_helpers.py +25 -1
  8. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/models/author.py +7 -2
  9. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/models/environment.py +1 -1
  10. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/dialect/duckdb.py +1 -0
  11. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/parsing/parse_engine.py +1 -1
  12. pytrilogy-0.0.3.32/trilogy/std/display.preql +3 -0
  13. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/LICENSE.md +0 -0
  14. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/README.md +0 -0
  15. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/pyproject.toml +0 -0
  16. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/pytrilogy.egg-info/dependency_links.txt +0 -0
  17. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/pytrilogy.egg-info/entry_points.txt +0 -0
  18. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/pytrilogy.egg-info/requires.txt +0 -0
  19. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/pytrilogy.egg-info/top_level.txt +0 -0
  20. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/setup.cfg +0 -0
  21. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/setup.py +0 -0
  22. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_datatypes.py +0 -0
  23. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_declarations.py +0 -0
  24. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_derived_concepts.py +0 -0
  25. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_discovery_nodes.py +0 -0
  26. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_enums.py +0 -0
  27. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_executor.py +0 -0
  28. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_functions.py +0 -0
  29. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_imports.py +0 -0
  30. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_metadata.py +0 -0
  31. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_models.py +0 -0
  32. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_multi_join_assignments.py +0 -0
  33. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_parse_engine.py +0 -0
  34. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_parsing.py +0 -0
  35. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_partial_handling.py +0 -0
  36. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_query_processing.py +0 -0
  37. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_query_render.py +0 -0
  38. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_select.py +0 -0
  39. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_show.py +0 -0
  40. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_statements.py +0 -0
  41. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_typing.py +0 -0
  42. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_undefined_concept.py +0 -0
  43. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_user_functions.py +0 -0
  44. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/tests/test_where_clause.py +0 -0
  45. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/authoring/__init__.py +0 -0
  46. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/compiler.py +0 -0
  47. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/constants.py +0 -0
  48. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/__init__.py +0 -0
  49. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/constants.py +0 -0
  50. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/env_processor.py +0 -0
  51. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/ergonomics.py +0 -0
  52. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/exceptions.py +0 -0
  53. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/functions.py +0 -0
  54. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/graph_models.py +0 -0
  55. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/internal.py +0 -0
  56. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/models/__init__.py +0 -0
  57. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/models/build.py +0 -0
  58. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/models/build_environment.py +0 -0
  59. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/models/core.py +0 -0
  60. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/models/datasource.py +0 -0
  61. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/models/execute.py +0 -0
  62. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/optimization.py +0 -0
  63. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/optimizations/__init__.py +0 -0
  64. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/optimizations/base_optimization.py +0 -0
  65. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/optimizations/inline_constant.py +0 -0
  66. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/optimizations/inline_datasource.py +0 -0
  67. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/optimizations/predicate_pushdown.py +0 -0
  68. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/__init__.py +0 -0
  69. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/concept_strategies_v3.py +0 -0
  70. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/graph_utils.py +0 -0
  71. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/node_generators/__init__.py +0 -0
  72. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/node_generators/basic_node.py +0 -0
  73. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/node_generators/common.py +0 -0
  74. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/node_generators/filter_node.py +0 -0
  75. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/node_generators/group_node.py +0 -0
  76. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/node_generators/group_to_node.py +0 -0
  77. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/node_generators/multiselect_node.py +0 -0
  78. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/node_generators/node_merge_node.py +0 -0
  79. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/node_generators/rowset_node.py +0 -0
  80. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/node_generators/select_helpers/__init__.py +0 -0
  81. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/node_generators/select_helpers/datasource_injection.py +0 -0
  82. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/node_generators/select_merge_node.py +0 -0
  83. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/node_generators/select_node.py +0 -0
  84. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/node_generators/synonym_node.py +0 -0
  85. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/node_generators/union_node.py +0 -0
  86. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/node_generators/unnest_node.py +0 -0
  87. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/node_generators/window_node.py +0 -0
  88. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/nodes/__init__.py +0 -0
  89. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/nodes/base_node.py +0 -0
  90. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/nodes/filter_node.py +0 -0
  91. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/nodes/group_node.py +0 -0
  92. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/nodes/merge_node.py +0 -0
  93. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/nodes/select_node_v2.py +0 -0
  94. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/nodes/union_node.py +0 -0
  95. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/nodes/unnest_node.py +0 -0
  96. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/nodes/window_node.py +0 -0
  97. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/processing/utility.py +0 -0
  98. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/query_processor.py +0 -0
  99. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/statements/__init__.py +0 -0
  100. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/statements/author.py +0 -0
  101. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/statements/build.py +0 -0
  102. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/statements/common.py +0 -0
  103. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/core/statements/execute.py +0 -0
  104. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/dialect/__init__.py +0 -0
  105. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/dialect/base.py +0 -0
  106. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/dialect/bigquery.py +0 -0
  107. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/dialect/common.py +0 -0
  108. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/dialect/config.py +0 -0
  109. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/dialect/dataframe.py +0 -0
  110. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/dialect/enums.py +0 -0
  111. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/dialect/postgres.py +0 -0
  112. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/dialect/presto.py +0 -0
  113. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/dialect/snowflake.py +0 -0
  114. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/dialect/sql_server.py +0 -0
  115. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/engine.py +0 -0
  116. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/executor.py +0 -0
  117. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/hooks/__init__.py +0 -0
  118. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/hooks/base_hook.py +0 -0
  119. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/hooks/graph_hook.py +0 -0
  120. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/hooks/query_debugger.py +0 -0
  121. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/metadata/__init__.py +0 -0
  122. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/parser.py +0 -0
  123. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/parsing/__init__.py +0 -0
  124. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/parsing/common.py +0 -0
  125. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/parsing/config.py +0 -0
  126. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/parsing/exceptions.py +0 -0
  127. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/parsing/helpers.py +0 -0
  128. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/parsing/render.py +0 -0
  129. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/parsing/trilogy.lark +0 -0
  130. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/py.typed +0 -0
  131. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/render.py +0 -0
  132. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/scripts/__init__.py +0 -0
  133. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/scripts/trilogy.py +0 -0
  134. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/std/__init__.py +0 -0
  135. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/std/dashboard.preql +0 -0
  136. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/std/date.preql +0 -0
  137. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/std/geography.preql +0 -0
  138. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/std/money.preql +0 -0
  139. {pytrilogy-0.0.3.30 → pytrilogy-0.0.3.32}/trilogy/utility.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytrilogy
3
- Version: 0.0.3.30
3
+ Version: 0.0.3.32
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.4
2
2
  Name: pytrilogy
3
- Version: 0.0.3.30
3
+ Version: 0.0.3.32
4
4
  Summary: Declarative, typed query language that compiles to SQL.
5
5
  Home-page:
6
6
  Author:
@@ -132,5 +132,6 @@ trilogy/scripts/trilogy.py
132
132
  trilogy/std/__init__.py
133
133
  trilogy/std/dashboard.preql
134
134
  trilogy/std/date.preql
135
+ trilogy/std/display.preql
135
136
  trilogy/std/geography.preql
136
137
  trilogy/std/money.preql
@@ -13,6 +13,63 @@ from trilogy.core.models.core import DataType
13
13
  from trilogy.core.models.environment import Environment, LazyEnvironment
14
14
 
15
15
 
16
+ def test_concept_rehydration():
17
+ test = {
18
+ "name": "order_timestamp.month_start",
19
+ "datatype": "date",
20
+ "purpose": "property",
21
+ "derivation": "root",
22
+ "granularity": "multi_row",
23
+ "metadata": {
24
+ "description": "Auto-derived from a local.order_timestamp. The date truncated to the month.",
25
+ "line_number": None,
26
+ "concept_source": "auto_derived",
27
+ },
28
+ "lineage": {
29
+ "operator": "date_truncate",
30
+ "arg_count": 2,
31
+ "output_datatype": "date",
32
+ "output_purpose": "property",
33
+ "valid_inputs": [
34
+ ["datetime", "string", "timestamp", "date"],
35
+ ["date_part"],
36
+ ],
37
+ "arguments": [
38
+ {
39
+ "address": "local.order_timestamp",
40
+ "datatype": "timestamp",
41
+ "metadata": {
42
+ "description": None,
43
+ "line_number": None,
44
+ "concept_source": "manual",
45
+ },
46
+ },
47
+ "month",
48
+ ],
49
+ },
50
+ "namespace": "local",
51
+ "keys": ["local.order_timestamp"],
52
+ "grain": {"components": ["local.order_id"], "where_clause": None},
53
+ "modifiers": [],
54
+ "pseudonyms": [],
55
+ }
56
+ Concept.model_validate(test)
57
+ test["lineage"]["arguments"] = [
58
+ {
59
+ "address": "local.order_timestamp",
60
+ "datatype": "timestamp",
61
+ "metadata": {
62
+ "description": None,
63
+ "line_number": None,
64
+ "concept_source": "manual",
65
+ },
66
+ },
67
+ "monthz",
68
+ ]
69
+ with raises(TypeError):
70
+ Concept.model_validate(test)
71
+
72
+
16
73
  def test_environment_serialization(test_environment: Environment):
17
74
 
18
75
  path = test_environment.to_cache()
@@ -4,6 +4,6 @@ from trilogy.dialect.enums import Dialects
4
4
  from trilogy.executor import Executor
5
5
  from trilogy.parser import parse
6
6
 
7
- __version__ = "0.0.3.30"
7
+ __version__ = "0.0.3.32"
8
8
 
9
9
  __all__ = ["parse", "Executor", "Dialects", "Environment", "CONFIG"]
@@ -287,6 +287,8 @@ class ComparisonOperator(Enum):
287
287
  return ComparisonOperator.IS_NOT
288
288
  if value == ["in"]:
289
289
  return ComparisonOperator.IN
290
+ if str(value).lower() != str(value):
291
+ return ComparisonOperator(str(value).lower())
290
292
  return super()._missing_(str(value).lower())
291
293
 
292
294
 
@@ -1,5 +1,5 @@
1
1
  from trilogy.constants import DEFAULT_NAMESPACE
2
- from trilogy.core.enums import ConceptSource, FunctionType, Purpose
2
+ from trilogy.core.enums import ConceptSource, DatePart, FunctionType, Purpose
3
3
  from trilogy.core.functions import AttrAccess, FunctionFactory
4
4
  from trilogy.core.models.author import Concept, Function, Metadata
5
5
  from trilogy.core.models.core import DataType, StructType, arg_to_datatype
@@ -64,6 +64,30 @@ def generate_date_concepts(concept: Concept, environment: Environment):
64
64
  if new_concept.name in environment.concepts:
65
65
  continue
66
66
  environment.add_concept(new_concept, add_derived=False)
67
+ for grain in [DatePart.MONTH, DatePart.YEAR]:
68
+ function = factory.create_function(
69
+ operator=FunctionType.DATE_TRUNCATE,
70
+ args=[concept, grain],
71
+ )
72
+ new_concept = Concept(
73
+ name=f"{concept.name}.{grain.value}_start",
74
+ datatype=DataType.DATE,
75
+ purpose=Purpose.PROPERTY,
76
+ lineage=function,
77
+ grain=concept.grain,
78
+ namespace=concept.namespace,
79
+ keys=set(
80
+ [concept.address],
81
+ ),
82
+ metadata=Metadata(
83
+ description=f"Auto-derived from {base_description}. The date truncated to the {grain.value}.",
84
+ line_number=base_line_number,
85
+ concept_source=ConceptSource.AUTO_DERIVED,
86
+ ),
87
+ )
88
+ if new_concept.name in environment.concepts:
89
+ continue
90
+ environment.add_concept(new_concept, add_derived=False)
67
91
 
68
92
 
69
93
  def generate_datetime_concepts(concept: Concept, environment: Environment):
@@ -1658,8 +1658,13 @@ class Function(DataTyped, ConceptArgs, Mergeable, Namespaced, BaseModel):
1658
1658
  # attempt to exit early to avoid checking all types
1659
1659
  break
1660
1660
  elif isinstance(arg, ptype):
1661
+ if isinstance(arg, str) and DataType.DATE_PART in valid_inputs[idx]:
1662
+ if arg not in [x.value for x in DatePart]:
1663
+ pass
1664
+ else:
1665
+ break
1661
1666
  raise TypeError(
1662
- f"Invalid {dtype} constant passed into {operator_name} {arg}, expecting one of {valid_inputs[idx]}"
1667
+ f'Invalid {dtype} constant passed into {operator_name} "{arg}", expecting one of {valid_inputs[idx]}'
1663
1668
  )
1664
1669
  return v
1665
1670
 
@@ -2362,6 +2367,7 @@ FuncArgs = (
2362
2367
  | FilterItem
2363
2368
  | int
2364
2369
  | float
2370
+ | DatePart
2365
2371
  | str
2366
2372
  | date
2367
2373
  | datetime
@@ -2371,7 +2377,6 @@ FuncArgs = (
2371
2377
  | ListType
2372
2378
  | MapType
2373
2379
  | NumericType
2374
- | DatePart
2375
2380
  | list
2376
2381
  | ListWrapper[Any]
2377
2382
  )
@@ -250,7 +250,7 @@ class Environment(BaseModel):
250
250
  imports=dict(self.imports),
251
251
  namespace=self.namespace,
252
252
  working_path=self.working_path,
253
- environment_config=self.config,
253
+ environment_config=self.config.model_copy(deep=True),
254
254
  version=self.version,
255
255
  cte_name_map=dict(self.cte_name_map),
256
256
  materialized_concepts=set(self.materialized_concepts),
@@ -27,6 +27,7 @@ FUNCTION_MAP = {
27
27
  FunctionType.INDEX_ACCESS: lambda args: (f"{args[0]}[{args[1]}]"),
28
28
  # datetime is aliased
29
29
  FunctionType.CURRENT_DATETIME: lambda x: "cast(get_current_timestamp() as datetime)",
30
+ FunctionType.DATE: lambda x: f"cast({x[0]} as date)",
30
31
  FunctionType.DATE_TRUNCATE: lambda x: f"date_trunc('{x[1]}', {x[0]})",
31
32
  FunctionType.DATE_ADD: lambda x: f"date_add({x[0]}, {x[2]} * INTERVAL 1 {x[1]})",
32
33
  FunctionType.DATE_PART: lambda x: f"date_part('{x[1]}', {x[0]})",
@@ -961,7 +961,7 @@ class ParseToObjects(Transformer):
961
961
  lookup = address
962
962
  if lookup not in self.environment.config.import_resolver.content:
963
963
  raise ImportError(
964
- f"Unable to import file {lookup}, not found in imsport resolver"
964
+ f"Unable to import file {lookup}, not resolvable from provided source files."
965
965
  )
966
966
  text = self.environment.config.import_resolver.content[lookup]
967
967
  else:
@@ -0,0 +1,3 @@
1
+
2
+
3
+ type percent float; # Percentage value
File without changes
File without changes
File without changes
File without changes