omnata-plugin-runtime 0.11.0a310__tar.gz → 0.11.0a312__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.11.0a310
3
+ Version: 0.11.0a312
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.11.0-a310"
3
+ version = "0.11.0-a312"
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"
@@ -470,10 +470,20 @@ class SnowflakeViewPart(BaseModel):
470
470
  c.name_with_comment(binding_list) for c in self.columns
471
471
  ]
472
472
 
473
- def cte_text(self,original_name: bool = False, include_only_columns:Optional[List[str]] = None) -> str:
473
+ def cte_text(self,original_name: bool = False,
474
+ include_only_columns:Optional[List[str]] = None,
475
+ include_extra_columns:Optional[List[str]] = None
476
+ ) -> str:
474
477
  """
475
478
  Returns the CTE text for this view part.
476
479
  """
480
+ if include_extra_columns is not None:
481
+ # includes direct columns plus any extra specified
482
+ return f""" "{self.stream_name}" as (
483
+ select {', '.join([c.definition(original_name=original_name,remove_stream_prefix=self.stream_name) for c in self.columns
484
+ if c.original_name in include_extra_columns or not c.is_join_column])}
485
+ from {self.raw_table_location.get_fully_qualified_name()}
486
+ ) """
477
487
  if include_only_columns is None:
478
488
  return f""" "{self.stream_name}" as (
479
489
  select {', '.join([c.definition(original_name=original_name,remove_stream_prefix=self.stream_name) for c in self.direct_columns()])}
@@ -543,7 +553,7 @@ class SnowflakeViewParts(BaseModel):
543
553
 
544
554
 
545
555
  ctes = [
546
- self.main_part.cte_text(original_name=True)
556
+ self.main_part.cte_text(original_name=True,include_extra_columns=all_referenced_columns.get(self.main_part.stream_name))
547
557
  ] + [
548
558
  part.cte_text(original_name=True,include_only_columns=all_referenced_columns.get(part.stream_name))
549
559
  for part in joined_parts_deduped
@@ -1297,7 +1297,7 @@ class InboundSyncRequest(SyncRequest):
1297
1297
  # if the total exceeds 200MB, we apply the results immediately
1298
1298
  all_df_lists:List[List[pandas.DataFrame]] = list(self._apply_results.values())
1299
1299
  # flatten
1300
- all_dfs:List[pandas.DataFrame] = [x for sublist in all_df_lists for x in sublist]
1300
+ all_dfs:List[pandas.DataFrame] = [x for sublist in all_df_lists for x in sublist if isinstance(x, pandas.DataFrame)]
1301
1301
  combined_length = sum([len(x) for x in all_dfs])
1302
1302
  # first, don't bother if the count is less than 10000, since it's unlikely to be even close
1303
1303
  if combined_length > 10000:
@@ -1347,7 +1347,7 @@ class InboundSyncRequest(SyncRequest):
1347
1347
  combined_length = sum([len(x) for x in all_dfs])
1348
1348
  # first, don't both if the count is less than 10000, since it's unlikely to be even close
1349
1349
  if combined_length > 10000:
1350
- if sum([x.memory_usage(index=True).sum() for x in all_dfs]) > 200000000:
1350
+ if sum([x.memory_usage(index=True).sum() for x in all_dfs if isinstance(x, pandas.DataFrame)]) > 200000000:
1351
1351
  logger.debug(f"Applying criteria deletes queue immediately due to combined dataframe size")
1352
1352
  self.apply_results_queue()
1353
1353