omnata-plugin-runtime 0.11.0a314__tar.gz → 0.11.1a316__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,7 +1,8 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.11.0a314
3
+ Version: 0.11.1a316
4
4
  Summary: Classes and common runtime components for building and running Omnata Plugins
5
+ License-File: LICENSE
5
6
  Author: James Weakley
6
7
  Author-email: james.weakley@omnata.com
7
8
  Requires-Python: >=3.8,<=3.11
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "omnata-plugin-runtime"
3
- version = "0.11.0-a314"
3
+ version = "0.11.1-a316"
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"
@@ -557,7 +557,6 @@ class SnowflakeViewParts(BaseModel):
557
557
  # because they can be calculated directly without needing joins
558
558
  columns_only_referencing_own_stream:Dict[str,List[str]] = {}
559
559
 
560
-
561
560
  for part in [self.main_part] + self.joined_parts:
562
561
  # 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
562
  aliases_for_stream = [j.join_stream_alias for j in self.main_part.joins
@@ -570,7 +569,12 @@ class SnowflakeViewParts(BaseModel):
570
569
  for column in part.columns:
571
570
  if column.referenced_columns:
572
571
  for stream_name, referenced_columns in column.referenced_columns.items():
572
+ aliases_for_referenced_stream = [j.join_stream_name for j in self.main_part.joins
573
+ if j.join_stream_alias == stream_name]
573
574
  all_referenced_columns.setdefault(stream_name, []).extend(referenced_columns)
575
+ # the stream name could be an alias, so we need to check if it's one of the aliases for this part
576
+ for stream_name_for_alias in aliases_for_referenced_stream:
577
+ all_referenced_columns.setdefault(stream_name_for_alias, []).extend(referenced_columns)
574
578
  # 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
579
  if self.column_indirectly_references_other_streams(
576
580
  [self.main_part] + self.joined_parts, part.stream_name, column.original_name
@@ -582,8 +586,8 @@ class SnowflakeViewParts(BaseModel):
582
586
  # if this part has joins to other streams, we need to include the join columns
583
587
  for join in part.joins:
584
588
  all_referenced_columns.setdefault(join.join_stream_name, []).append(join.join_stream_column)
589
+ all_referenced_columns.setdefault(join.join_stream_alias, []).append(join.join_stream_column)
585
590
  all_referenced_columns.setdefault(part.stream_name, []).append(join.left_column)
586
-
587
591
  ctes = [
588
592
  self.main_part.cte_text(original_name=True,include_extra_columns=columns_only_referencing_own_stream.get(self.main_part.stream_name))
589
593
  ] + [
@@ -813,7 +817,13 @@ def find_part(view_part: SnowflakeViewPart, joined_parts: List[SnowflakeViewPart
813
817
  return part
814
818
  for join in view_part.joins:
815
819
  if join.join_stream_alias == stream_name:
816
- return view_part
820
+ # this is the join, we need to find the actual stream
821
+ for part in joined_parts:
822
+ if part.stream_name == join.join_stream_name:
823
+ return part
824
+ logger.warning(
825
+ f"Join alias {stream_name} maps to stream {join.join_stream_name}, but that stream is not in the joined parts"
826
+ )
817
827
  return None
818
828
 
819
829
  def prune(view_part: SnowflakeViewPart, joined_parts: List[SnowflakeViewPart]) -> bool: