omnata-plugin-runtime 0.10.6a243__tar.gz → 0.10.6a245__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.10.6a243
3
+ Version: 0.10.6a245
4
4
  Summary: Classes and common runtime components for building and running Omnata Plugins
5
5
  Author: James Weakley
6
6
  Author-email: james.weakley@omnata.com
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "omnata-plugin-runtime"
3
- version = "0.10.6-a243"
3
+ version = "0.10.6-a245"
4
4
  description = "Classes and common runtime components for building and running Omnata Plugins"
5
5
  authors = ["James Weakley <james.weakley@omnata.com>"]
6
6
  readme = "README.md"
@@ -257,13 +257,6 @@ class SnowflakeViewColumn(BaseModel):
257
257
  if column not in columns_to_move:
258
258
  columns_to_move.append(column)
259
259
 
260
- # do another pass, this time replacing the original name with the transformed name
261
- for column in join_columns:
262
- for other_column in join_columns:
263
- if f'"{column.original_name}"' in other_column.expression:
264
- if column.original_name != column.name:
265
- other_column.expression = other_column.expression.replace(f'"{column.original_name}"',f'"{column.name}"')
266
-
267
260
  # Move collected columns to the front
268
261
  for column in columns_to_move:
269
262
  join_columns.remove(column)
@@ -433,11 +426,22 @@ class SnowflakeViewParts(BaseModel):
433
426
  In the final select statement, the join columns will be aliased with their transformed names.
434
427
  """
435
428
  ctes = [self.main_part.cte_text(original_name=True)] + [part.cte_text(original_name=True) for part in self.joined_parts]
429
+ # we need a final CTE which selects the main part's direct columns and joined columns, with their original names
430
+ # then the final select statement will just be aliasing to the transformed names
431
+ final_cte = f""" OMNATA_FINAL_CTE as (
432
+ select {', '.join(
433
+ [
434
+ f'"{c.original_name}"' for c in self.main_part.direct_columns()
435
+ ]+[
436
+ c.definition(original_name=True) for c in self.main_part.join_columns()
437
+ ])}
438
+ from "{self.main_part.stream_name}"
439
+ ) """
440
+ ctes.append(final_cte)
436
441
  all_ctes = "\n,".join(ctes)
437
- main_columns = SnowflakeViewColumn.order_by_reference(self.main_part.direct_columns() +
442
+ main_columns:List[SnowflakeViewColumn] = SnowflakeViewColumn.order_by_reference(self.main_part.direct_columns() +
438
443
  self.main_part.join_columns())
439
- column_clauses = [c.definition() if c.is_join_column
440
- else f"\"{self.main_part.stream_name}\"."+c.original_to_transformed()
444
+ column_clauses = [f"\"OMNATA_FINAL_CTE\"."+c.original_to_transformed()
441
445
  for c in main_columns]
442
446
 
443
447
  view_body = f"""with {all_ctes}