omnata-plugin-runtime 0.10.9a258__py3-none-any.whl → 0.10.10__py3-none-any.whl

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.
@@ -427,12 +427,13 @@ class SnowflakeViewPart(BaseModel):
427
427
  c.name_with_comment(binding_list) for c in self.columns
428
428
  ]
429
429
 
430
- def cte_text(self,original_name: bool = False) -> str:
430
+ def cte_text(self,original_name: bool = False, include_only_columns:Optional[List[str]] = None) -> str:
431
431
  """
432
432
  Returns the CTE text for this view part.
433
433
  """
434
434
  return f""" "{self.stream_name}" as (
435
- select {', '.join([c.definition(original_name=original_name) for c in self.direct_columns()])}
435
+ select {', '.join([c.definition(original_name=original_name) for c in self.direct_columns()
436
+ if include_only_columns is None or c.original_name in include_only_columns])}
436
437
  from {self.raw_table_location.get_fully_qualified_name()}
437
438
  ) """
438
439
 
@@ -462,7 +463,30 @@ class SnowflakeViewParts(BaseModel):
462
463
  There will be a final SELECT statement that selects all columns from the main stream, and then adds any columns obtained via joins.
463
464
  In the final select statement, the join columns will be aliased with their transformed names.
464
465
  """
465
- ctes = [self.main_part.cte_text(original_name=True)] + [part.cte_text(original_name=True) for part in self.joined_parts]
466
+ # first, we need to collapse all referenced columns into a single map
467
+ all_referenced_columns:Dict[str,List[str]] = {}
468
+ for part in [self.main_part] + self.joined_parts:
469
+ for column in part.columns:
470
+ if column.referenced_columns:
471
+ for stream_name, referenced_columns in column.referenced_columns.items():
472
+ if stream_name not in all_referenced_columns:
473
+ all_referenced_columns[stream_name] = []
474
+ all_referenced_columns[stream_name] += referenced_columns
475
+ for join in part.joins:
476
+ if join.join_stream_name not in all_referenced_columns:
477
+ all_referenced_columns[join.join_stream_name] = []
478
+ all_referenced_columns[join.join_stream_name].append(join.join_stream_column)
479
+ if part.stream_name not in all_referenced_columns:
480
+ all_referenced_columns[part.stream_name] = []
481
+ all_referenced_columns[part.stream_name].append(join.left_column)
482
+
483
+
484
+ ctes = [
485
+ self.main_part.cte_text(original_name=True)
486
+ ] + [
487
+ part.cte_text(original_name=True,include_only_columns=all_referenced_columns.get(part.stream_name))
488
+ for part in self.joined_parts
489
+ ]
466
490
  # we need a final CTE which selects the main part's direct columns and joined columns, with their original names
467
491
  # then the final select statement will just be aliasing to the transformed names
468
492
  final_cte = f""" OMNATA_FINAL_CTE as (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.10.9a258
3
+ Version: 0.10.10
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
@@ -2,12 +2,12 @@ omnata_plugin_runtime/__init__.py,sha256=MS9d1whnfT_B3-ThqZ7l63QeC_8OEKTuaYV5wTw
2
2
  omnata_plugin_runtime/api.py,sha256=baGraSMiD4Yvi3ZWrEv_TKh8Ktd1U8riBdOpe9j0Puw,8202
3
3
  omnata_plugin_runtime/configuration.py,sha256=0rfIGv8rCu8OwL7m-VOXIBjd05iyaBWRdt2h9o6scwo,46754
4
4
  omnata_plugin_runtime/forms.py,sha256=9YHJ_T17lT-rwyDaUg_0yj_YMPda4DRCw_wrvf8hE0E,19964
5
- omnata_plugin_runtime/json_schema.py,sha256=Ch2tFcTDP16aZ3xFGSbnW7LVsbzIHNQFEhH9z2rHoTE,34417
5
+ omnata_plugin_runtime/json_schema.py,sha256=7dtIpA1pQ74-QozTnMvc3wAxbh9cLYiI15zyTlysOmg,35783
6
6
  omnata_plugin_runtime/logging.py,sha256=WBuZt8lF9E5oFWM4KYQbE8dDJ_HctJ1pN3BHwU6rcd0,4461
7
7
  omnata_plugin_runtime/omnata_plugin.py,sha256=M0b6f9lKKEoEI0zf-ZwZcIPKPQTmHTIMhvcrBc94Mhg,133278
8
8
  omnata_plugin_runtime/plugin_entrypoints.py,sha256=iqGl8_nEEnPGKg3Aem4YLSQ6d5xS3ju5gq8MJbx6sCA,31968
9
9
  omnata_plugin_runtime/rate_limiting.py,sha256=qpr5esU4Ks8hMzuMpSR3gLFdor2ZUXYWCjmsQH_K6lQ,25882
10
- omnata_plugin_runtime-0.10.9a258.dist-info/LICENSE,sha256=rGaMQG3R3F5-JGDp_-rlMKpDIkg5n0SI4kctTk8eZSI,56
11
- omnata_plugin_runtime-0.10.9a258.dist-info/METADATA,sha256=G3vOesOSgrV7I3aYFpmLohE7DgN-0Kdd6iolWySP7_Y,2211
12
- omnata_plugin_runtime-0.10.9a258.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
13
- omnata_plugin_runtime-0.10.9a258.dist-info/RECORD,,
10
+ omnata_plugin_runtime-0.10.10.dist-info/LICENSE,sha256=rGaMQG3R3F5-JGDp_-rlMKpDIkg5n0SI4kctTk8eZSI,56
11
+ omnata_plugin_runtime-0.10.10.dist-info/METADATA,sha256=uIovVZDtcaChPAV1aL1zkFjMo_juBIRBQjHg9v6m2HE,2208
12
+ omnata_plugin_runtime-0.10.10.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
13
+ omnata_plugin_runtime-0.10.10.dist-info/RECORD,,