pytrilogy 0.0.3.14__tar.gz → 0.0.3.16__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 (133) hide show
  1. {pytrilogy-0.0.3.14/pytrilogy.egg-info → pytrilogy-0.0.3.16}/PKG-INFO +1 -1
  2. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16/pytrilogy.egg-info}/PKG-INFO +1 -1
  3. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/__init__.py +1 -1
  4. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/models/execute.py +16 -8
  5. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/concept_strategies_v3.py +1 -1
  6. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/node_generators/select_merge_node.py +3 -0
  7. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/dialect/base.py +3 -3
  8. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/dialect/common.py +2 -0
  9. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/dialect/duckdb.py +7 -4
  10. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/LICENSE.md +0 -0
  11. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/README.md +0 -0
  12. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/pyproject.toml +0 -0
  13. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/pytrilogy.egg-info/SOURCES.txt +0 -0
  14. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/pytrilogy.egg-info/dependency_links.txt +0 -0
  15. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/pytrilogy.egg-info/entry_points.txt +0 -0
  16. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/pytrilogy.egg-info/requires.txt +0 -0
  17. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/pytrilogy.egg-info/top_level.txt +0 -0
  18. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/setup.cfg +0 -0
  19. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/setup.py +0 -0
  20. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_datatypes.py +0 -0
  21. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_declarations.py +0 -0
  22. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_derived_concepts.py +0 -0
  23. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_discovery_nodes.py +0 -0
  24. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_enums.py +0 -0
  25. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_environment.py +0 -0
  26. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_executor.py +0 -0
  27. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_functions.py +0 -0
  28. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_imports.py +0 -0
  29. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_metadata.py +0 -0
  30. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_models.py +0 -0
  31. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_multi_join_assignments.py +0 -0
  32. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_parse_engine.py +0 -0
  33. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_parsing.py +0 -0
  34. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_partial_handling.py +0 -0
  35. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_query_processing.py +0 -0
  36. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_query_render.py +0 -0
  37. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_select.py +0 -0
  38. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_show.py +0 -0
  39. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_statements.py +0 -0
  40. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_typing.py +0 -0
  41. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_undefined_concept.py +0 -0
  42. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_user_functions.py +0 -0
  43. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/tests/test_where_clause.py +0 -0
  44. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/authoring/__init__.py +0 -0
  45. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/compiler.py +0 -0
  46. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/constants.py +0 -0
  47. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/__init__.py +0 -0
  48. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/constants.py +0 -0
  49. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/enums.py +0 -0
  50. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/env_processor.py +0 -0
  51. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/environment_helpers.py +0 -0
  52. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/ergonomics.py +0 -0
  53. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/exceptions.py +0 -0
  54. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/functions.py +0 -0
  55. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/graph_models.py +0 -0
  56. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/internal.py +0 -0
  57. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/models/__init__.py +0 -0
  58. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/models/author.py +0 -0
  59. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/models/build.py +0 -0
  60. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/models/build_environment.py +0 -0
  61. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/models/core.py +0 -0
  62. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/models/datasource.py +0 -0
  63. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/models/environment.py +0 -0
  64. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/optimization.py +0 -0
  65. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/optimizations/__init__.py +0 -0
  66. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/optimizations/base_optimization.py +0 -0
  67. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/optimizations/inline_constant.py +0 -0
  68. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/optimizations/inline_datasource.py +0 -0
  69. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/optimizations/predicate_pushdown.py +0 -0
  70. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/__init__.py +0 -0
  71. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/graph_utils.py +0 -0
  72. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/node_generators/__init__.py +0 -0
  73. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/node_generators/basic_node.py +0 -0
  74. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/node_generators/common.py +0 -0
  75. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/node_generators/filter_node.py +0 -0
  76. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/node_generators/group_node.py +0 -0
  77. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/node_generators/group_to_node.py +0 -0
  78. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/node_generators/multiselect_node.py +0 -0
  79. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/node_generators/node_merge_node.py +0 -0
  80. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/node_generators/rowset_node.py +0 -0
  81. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/node_generators/select_helpers/__init__.py +0 -0
  82. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/node_generators/select_helpers/datasource_injection.py +0 -0
  83. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/node_generators/select_node.py +0 -0
  84. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/node_generators/synonym_node.py +0 -0
  85. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/node_generators/union_node.py +0 -0
  86. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/node_generators/unnest_node.py +0 -0
  87. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/node_generators/window_node.py +0 -0
  88. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/nodes/__init__.py +0 -0
  89. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/nodes/base_node.py +0 -0
  90. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/nodes/filter_node.py +0 -0
  91. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/nodes/group_node.py +0 -0
  92. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/nodes/merge_node.py +0 -0
  93. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/nodes/select_node_v2.py +0 -0
  94. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/nodes/union_node.py +0 -0
  95. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/nodes/unnest_node.py +0 -0
  96. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/nodes/window_node.py +0 -0
  97. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/processing/utility.py +0 -0
  98. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/query_processor.py +0 -0
  99. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/statements/__init__.py +0 -0
  100. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/statements/author.py +0 -0
  101. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/statements/build.py +0 -0
  102. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/statements/common.py +0 -0
  103. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/core/statements/execute.py +0 -0
  104. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/dialect/__init__.py +0 -0
  105. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/dialect/bigquery.py +0 -0
  106. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/dialect/config.py +0 -0
  107. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/dialect/dataframe.py +0 -0
  108. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/dialect/enums.py +0 -0
  109. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/dialect/postgres.py +0 -0
  110. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/dialect/presto.py +0 -0
  111. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/dialect/snowflake.py +0 -0
  112. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/dialect/sql_server.py +0 -0
  113. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/engine.py +0 -0
  114. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/executor.py +0 -0
  115. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/hooks/__init__.py +0 -0
  116. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/hooks/base_hook.py +0 -0
  117. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/hooks/graph_hook.py +0 -0
  118. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/hooks/query_debugger.py +0 -0
  119. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/metadata/__init__.py +0 -0
  120. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/parser.py +0 -0
  121. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/parsing/__init__.py +0 -0
  122. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/parsing/common.py +0 -0
  123. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/parsing/config.py +0 -0
  124. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/parsing/exceptions.py +0 -0
  125. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/parsing/helpers.py +0 -0
  126. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/parsing/parse_engine.py +0 -0
  127. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/parsing/render.py +0 -0
  128. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/parsing/trilogy.lark +0 -0
  129. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/py.typed +0 -0
  130. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/render.py +0 -0
  131. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/scripts/__init__.py +0 -0
  132. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/scripts/trilogy.py +0 -0
  133. {pytrilogy-0.0.3.14 → pytrilogy-0.0.3.16}/trilogy/utility.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pytrilogy
3
- Version: 0.0.3.14
3
+ Version: 0.0.3.16
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.2
2
2
  Name: pytrilogy
3
- Version: 0.0.3.14
3
+ Version: 0.0.3.16
4
4
  Summary: Declarative, typed query language that compiles to SQL.
5
5
  Home-page:
6
6
  Author:
@@ -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.14"
7
+ __version__ = "0.0.3.16"
8
8
 
9
9
  __all__ = ["parse", "Executor", "Dialects", "Environment", "CONFIG"]
@@ -305,14 +305,17 @@ class CTE(BaseModel):
305
305
  return self.source.name
306
306
 
307
307
  @property
308
- def quote_address(self) -> bool:
309
- if self.is_root_datasource:
310
- candidate = self.source.datasources[0]
311
- if isinstance(candidate, DATASOURCE_TYPES) and isinstance(
312
- candidate.address, Address
313
- ):
314
- return candidate.address.quoted
315
- return False
308
+ def quote_address(self) -> dict[str, bool]:
309
+
310
+ return {
311
+ candidate.safe_identifier: (
312
+ candidate.address.quoted and not candidate.address.is_query
313
+ if isinstance(candidate, BuildDatasource)
314
+ and isinstance(candidate.address, Address)
315
+ else False
316
+ )
317
+ for candidate in self.source.datasources
318
+ }
316
319
 
317
320
  @property
318
321
  def base_alias(self) -> str:
@@ -870,6 +873,7 @@ class Join(BaseModel):
870
873
  left_cte: CTE | None = None
871
874
  joinkey_pairs: List[CTEConceptPair] | None = None
872
875
  inlined_ctes: set[str] = Field(default_factory=set)
876
+ quote: str | None = None
873
877
 
874
878
  def inline_cte(self, cte: CTE):
875
879
  self.inlined_ctes.add(cte.name)
@@ -887,6 +891,10 @@ class Join(BaseModel):
887
891
 
888
892
  @property
889
893
  def right_ref(self) -> str:
894
+ if self.quote:
895
+ if self.right_cte.identifier in self.inlined_ctes:
896
+ return f"{self.quote}{self.right_cte.source.datasources[0].safe_location}{self.quote} as {self.right_cte.source.datasources[0].safe_identifier}"
897
+ return self.right_cte.safe_identifier
890
898
  if self.right_cte.identifier in self.inlined_ctes:
891
899
  return f"{self.right_cte.source.datasources[0].safe_location} as {self.right_cte.source.datasources[0].safe_identifier}"
892
900
  return self.right_cte.safe_identifier
@@ -395,6 +395,7 @@ def generate_node(
395
395
  environment=environment,
396
396
  parents=[],
397
397
  depth=depth + 1,
398
+ preexisting_conditions=conditions.conditional if conditions else None,
398
399
  )
399
400
  elif concept.derivation == Derivation.BASIC:
400
401
  # this is special case handling for group bys
@@ -786,7 +787,6 @@ def _search_concepts(
786
787
  )
787
788
  # if anything we need to get is in the filter set and it's a computed value
788
789
  # we need to get _everything_ in this loop
789
- logger.info(f"{[x.address for x in conditions.row_arguments]}")
790
790
  if any(
791
791
  [
792
792
  x.derivation not in (Derivation.ROOT, Derivation.CONSTANT)
@@ -405,6 +405,7 @@ def create_select_node(
405
405
  # no partial for constants
406
406
  partial_concepts=[],
407
407
  force_group=False,
408
+ preexisting_conditions=conditions.conditional if conditions else None,
408
409
  )
409
410
 
410
411
  datasource: dict[str, BuildDatasource | list[BuildDatasource]] = (
@@ -491,6 +492,7 @@ def gen_select_merge_node(
491
492
  depth=depth,
492
493
  partial_concepts=[],
493
494
  force_group=False,
495
+ preexisting_conditions=conditions.conditional if conditions else None,
494
496
  )
495
497
  for attempt in [False, True]:
496
498
  pruned_concept_graph = create_pruned_concept_graph(
@@ -542,6 +544,7 @@ def gen_select_merge_node(
542
544
  depth=depth,
543
545
  partial_concepts=[],
544
546
  force_group=False,
547
+ preexisting_conditions=conditions.conditional if conditions else None,
545
548
  )
546
549
  )
547
550
 
@@ -156,7 +156,7 @@ FUNCTION_MAP = {
156
156
  FunctionType.PARENTHETICAL: lambda x: f"({x[0]})",
157
157
  # Complex
158
158
  FunctionType.INDEX_ACCESS: lambda x: f"{x[0]}[{x[1]}]",
159
- FunctionType.MAP_ACCESS: lambda x: f"{x[0]}[{x[1]}][1]",
159
+ FunctionType.MAP_ACCESS: lambda x: f"{x[0]}[{x[1]}]",
160
160
  FunctionType.UNNEST: lambda x: f"unnest({x[0]})",
161
161
  FunctionType.ATTR_ACCESS: lambda x: f"""{x[0]}.{x[1].replace("'", "")}""",
162
162
  FunctionType.STRUCT: lambda x: f"{{{', '.join(struct_arg(x))}}}",
@@ -734,7 +734,7 @@ class BaseDialect:
734
734
  else:
735
735
  source = None
736
736
  else:
737
- if cte.quote_address:
737
+ if cte.quote_address.get(cte.source.datasources[0].safe_identifier, False):
738
738
  source = f"{self.QUOTE_CHARACTER}{cte.base_name}{self.QUOTE_CHARACTER}"
739
739
  else:
740
740
  source = cte.base_name
@@ -769,8 +769,8 @@ class BaseDialect:
769
769
  base=f"{source}" if source else None,
770
770
  grain=cte.grain,
771
771
  limit=cte.limit,
772
- # some joins may not need to be rendered
773
772
  comment=cte.comment if CONFIG.show_comments else None,
773
+ # some joins may not need to be rendered
774
774
  joins=[
775
775
  j
776
776
  for j in [
@@ -70,6 +70,8 @@ def render_join(
70
70
  return f"FULL JOIN {render_unnest(unnest_mode, quote_character, join.concept_to_unnest, render_func, cte)}"
71
71
  # left_name = join.left_name
72
72
  right_name = join.right_name
73
+ if cte.quote_address.get(join.right_name, False):
74
+ join.quote = quote_character
73
75
  right_base = join.right_ref
74
76
  base_joinkeys = []
75
77
  if join.joinkey_pairs:
@@ -55,11 +55,14 @@ DUCKDB_TEMPLATE = Template(
55
55
  CREATE OR REPLACE TABLE {{ output.address.location }} AS
56
56
  {% endif %}{%- if ctes %}
57
57
  WITH {% for cte in ctes %}
58
- {{cte.name}} as ({{cte.statement}}){% if not loop.last %},{% endif %}{% endfor %}{% endif %}
59
- {%- if full_select -%}{{full_select}}
58
+ {{cte.name}} as (
59
+ {{cte.statement}}){% if not loop.last %},{% else %}
60
+ {% endif %}{% endfor %}{% endif %}
61
+ {%- if full_select -%}
62
+ {{full_select}}
60
63
  {%- else -%}{%- if comment -%}
61
- -- {{ comment }}{%- endif -%}
62
- SELECT
64
+ -- {{ comment }}
65
+ {%- endif %}SELECT
63
66
  {%- for select in select_columns %}
64
67
  {{ select }}{% if not loop.last %},{% endif %}{% endfor %}
65
68
  {% if base %}FROM
File without changes
File without changes
File without changes
File without changes