omnata-plugin-runtime 0.4.9__tar.gz → 0.4.10__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.4.9
3
+ Version: 0.4.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
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "omnata-plugin-runtime"
3
- version = "0.4.9"
3
+ version = "0.4.10"
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"
@@ -688,6 +688,10 @@ class OutboundSyncRequest(SyncRequest):
688
688
  results_df["APP_IDENTIFIER"] = None
689
689
  if "LOADBATCH_ID" not in results_df:
690
690
  results_df["LOADBATCH_ID"] = self._get_next_loadbatch_id()
691
+ # we dump the result data to a json string to make uploading to Snowflake less error prone, but only if it's not None
692
+ results_df["RESULT"] = results_df["RESULT"].apply(
693
+ lambda x: json.dumps(x) if x is not None else None
694
+ )
691
695
  # trim out the columns we don't need to return
692
696
  return results_df[
693
697
  results_df.columns.intersection(
@@ -747,6 +751,12 @@ class OutboundSyncRequest(SyncRequest):
747
751
  data_frame["TRANSFORMED_RECORD"] = data_frame[
748
752
  "TRANSFORMED_RECORD"
749
753
  ].apply(json.loads)
754
+ # we also perform json.loads on TRANSFORMED_RECORD_PREVIOUS, but only if it's not null
755
+ data_frame["TRANSFORMED_RECORD_PREVIOUS"] = data_frame[
756
+ "TRANSFORMED_RECORD_PREVIOUS"
757
+ ].apply(
758
+ lambda x: json.loads(x) if x is not None else None
759
+ )
750
760
  except TypeError as type_error:
751
761
  logger.error(
752
762
  "Error parsing transformed record output as JSON", exc_info=True
@@ -838,7 +848,7 @@ class OutboundSyncRequest(SyncRequest):
838
848
  self._session.table(self._full_records_table_name)
839
849
  .filter((col("SYNC_ACTION").in_(sync_action_names))) # type: ignore
840
850
  .select(
841
- col("IDENTIFIER"),col("APP_IDENTIFIER"),col("RESULT"), col("SYNC_ACTION"), col("TRANSFORMED_RECORD")
851
+ col("IDENTIFIER"),col("APP_IDENTIFIER"),col("RESULT"), col("SYNC_ACTION"), col("TRANSFORMED_RECORD"), col("TRANSFORMED_RECORD_PREVIOUS")
842
852
  )
843
853
  )
844
854
  # apply sorting