omnata-plugin-runtime 0.11.1a315__py3-none-any.whl → 0.11.2a317__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.
@@ -534,7 +534,8 @@ class SnowflakeViewParts(BaseModel):
534
534
  all_view_parts, ref_stream, ref_col
535
535
  ) for ref_col in ref_cols
536
536
  )
537
- return result
537
+ if result:
538
+ return True
538
539
  return False
539
540
 
540
541
  def view_body(self):
@@ -557,7 +558,6 @@ class SnowflakeViewParts(BaseModel):
557
558
  # because they can be calculated directly without needing joins
558
559
  columns_only_referencing_own_stream:Dict[str,List[str]] = {}
559
560
 
560
-
561
561
  for part in [self.main_part] + self.joined_parts:
562
562
  # if the main part references any columns in this part in its joins, we need to include those columns because they are used in the join condition
563
563
  aliases_for_stream = [j.join_stream_alias for j in self.main_part.joins
@@ -570,7 +570,12 @@ class SnowflakeViewParts(BaseModel):
570
570
  for column in part.columns:
571
571
  if column.referenced_columns:
572
572
  for stream_name, referenced_columns in column.referenced_columns.items():
573
+ aliases_for_referenced_stream = [j.join_stream_name for j in self.main_part.joins
574
+ if j.join_stream_alias == stream_name]
573
575
  all_referenced_columns.setdefault(stream_name, []).extend(referenced_columns)
576
+ # the stream name could be an alias, so we need to check if it's one of the aliases for this part
577
+ for stream_name_for_alias in aliases_for_referenced_stream:
578
+ all_referenced_columns.setdefault(stream_name_for_alias, []).extend(referenced_columns)
574
579
  # populate columns_only_referencing_own_stream by following the chain of references until we reach a column that references another stream or has no references
575
580
  if self.column_indirectly_references_other_streams(
576
581
  [self.main_part] + self.joined_parts, part.stream_name, column.original_name
@@ -578,12 +583,23 @@ class SnowflakeViewParts(BaseModel):
578
583
  columns_only_referencing_own_stream.setdefault(part.stream_name, []).append(column.original_name)
579
584
  else:
580
585
  # if the column has no references, it can be included in the initial CTE for its own stream
581
- columns_only_referencing_own_stream.setdefault(part.stream_name, []).append(column.original_name)
586
+ # but only if no columns in other streams reference it
587
+ referenced_by_other_columns = False
588
+ for other_column in part.columns:
589
+ if other_column==column:
590
+ continue
591
+ if other_column.referenced_columns:
592
+ for ref_stream, ref_cols in other_column.referenced_columns.items():
593
+ if ref_stream != part.stream_name and column.original_name in ref_cols:
594
+ referenced_by_other_columns = True
595
+ break
596
+ if not referenced_by_other_columns:
597
+ columns_only_referencing_own_stream.setdefault(part.stream_name, []).append(column.original_name)
582
598
  # if this part has joins to other streams, we need to include the join columns
583
599
  for join in part.joins:
584
600
  all_referenced_columns.setdefault(join.join_stream_name, []).append(join.join_stream_column)
601
+ all_referenced_columns.setdefault(join.join_stream_alias, []).append(join.join_stream_column)
585
602
  all_referenced_columns.setdefault(part.stream_name, []).append(join.left_column)
586
-
587
603
  ctes = [
588
604
  self.main_part.cte_text(original_name=True,include_extra_columns=columns_only_referencing_own_stream.get(self.main_part.stream_name))
589
605
  ] + [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.11.1a315
3
+ Version: 0.11.2a317
4
4
  Summary: Classes and common runtime components for building and running Omnata Plugins
5
5
  License-File: LICENSE
6
6
  Author: James Weakley
@@ -2,12 +2,12 @@ omnata_plugin_runtime/__init__.py,sha256=MS9d1whnfT_B3-ThqZ7l63QeC_8OEKTuaYV5wTw
2
2
  omnata_plugin_runtime/api.py,sha256=5gbjbnFy72Xjf0E3kbG23G0V2J3CorvD5kpBn_BkdlI,8084
3
3
  omnata_plugin_runtime/configuration.py,sha256=SffokJfgvy6V3kUsoEjXcK3GdNgHo6U3mgBEs0qBv4I,46972
4
4
  omnata_plugin_runtime/forms.py,sha256=Lrbr3otsFDrvHWJw7v-slsW4PvEHJ6BG1Yl8oaJfiDo,20529
5
- omnata_plugin_runtime/json_schema.py,sha256=rxqXPIxvUX0DQ0P38bOX4EckhAdXDurWwD7_BZC5igg,53529
5
+ omnata_plugin_runtime/json_schema.py,sha256=6Hj5SBAW3_moHtCZhVynOUUxCiIIETroCjKFFpPMGJM,54879
6
6
  omnata_plugin_runtime/logging.py,sha256=WBuZt8lF9E5oFWM4KYQbE8dDJ_HctJ1pN3BHwU6rcd0,4461
7
7
  omnata_plugin_runtime/omnata_plugin.py,sha256=PV1BzsqI2yi3pd6DBSRc1s1QJ_My-b6pewrB7ad4sms,140256
8
8
  omnata_plugin_runtime/plugin_entrypoints.py,sha256=_1pDLov3iQorGmfcae8Sw2bVjxw1vYeowBaKKNzRclQ,32629
9
9
  omnata_plugin_runtime/rate_limiting.py,sha256=qpr5esU4Ks8hMzuMpSR3gLFdor2ZUXYWCjmsQH_K6lQ,25882
10
- omnata_plugin_runtime-0.11.1a315.dist-info/METADATA,sha256=K14r2sSyt9KIz0EqhrrXr7Tsfo8uEesFXt8Koa_KH3g,2233
11
- omnata_plugin_runtime-0.11.1a315.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
12
- omnata_plugin_runtime-0.11.1a315.dist-info/licenses/LICENSE,sha256=rGaMQG3R3F5-JGDp_-rlMKpDIkg5n0SI4kctTk8eZSI,56
13
- omnata_plugin_runtime-0.11.1a315.dist-info/RECORD,,
10
+ omnata_plugin_runtime-0.11.2a317.dist-info/METADATA,sha256=vQ1Z_h_geCijwFZGpPaN9IshKj5rta5U4HB-jdffjJ8,2233
11
+ omnata_plugin_runtime-0.11.2a317.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
12
+ omnata_plugin_runtime-0.11.2a317.dist-info/licenses/LICENSE,sha256=rGaMQG3R3F5-JGDp_-rlMKpDIkg5n0SI4kctTk8eZSI,56
13
+ omnata_plugin_runtime-0.11.2a317.dist-info/RECORD,,