omnata-plugin-runtime 0.2.64__py3-none-any.whl → 0.2.66__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.
- omnata_plugin_runtime/forms.py +2 -0
- omnata_plugin_runtime/omnata_plugin.py +27 -13
- {omnata_plugin_runtime-0.2.64.dist-info → omnata_plugin_runtime-0.2.66.dist-info}/METADATA +1 -1
- {omnata_plugin_runtime-0.2.64.dist-info → omnata_plugin_runtime-0.2.66.dist-info}/RECORD +6 -6
- {omnata_plugin_runtime-0.2.64.dist-info → omnata_plugin_runtime-0.2.66.dist-info}/LICENSE +0 -0
- {omnata_plugin_runtime-0.2.64.dist-info → omnata_plugin_runtime-0.2.66.dist-info}/WHEEL +0 -0
omnata_plugin_runtime/forms.py
CHANGED
@@ -103,6 +103,7 @@ class InformationField(SubscriptableBaseModel):
|
|
103
103
|
markdown_content: str
|
104
104
|
depends_on: Optional[str] = None
|
105
105
|
type: Literal["information"] = "information"
|
106
|
+
reload_on_change: bool = False
|
106
107
|
|
107
108
|
class InformationBoxField(SubscriptableBaseModel):
|
108
109
|
"""
|
@@ -119,6 +120,7 @@ class InformationBoxField(SubscriptableBaseModel):
|
|
119
120
|
markdown_content: str
|
120
121
|
depends_on: Optional[str] = None
|
121
122
|
type: Literal["information_box"] = "information_box"
|
123
|
+
reload_on_change: bool = False
|
122
124
|
box_type: Literal["info", "warning", "error"] = "info"
|
123
125
|
box_icon: Optional[str] = None
|
124
126
|
|
@@ -12,7 +12,7 @@ import queue
|
|
12
12
|
import threading
|
13
13
|
from abc import ABC, abstractmethod
|
14
14
|
from decimal import Decimal
|
15
|
-
from functools import partial, wraps
|
15
|
+
from functools import partial, wraps, reduce
|
16
16
|
from logging import getLogger
|
17
17
|
from typing import Any, Callable, Dict, Iterable, List, Literal, Optional, Type, cast
|
18
18
|
|
@@ -1037,28 +1037,36 @@ class InboundSyncRequest(SyncRequest):
|
|
1037
1037
|
]
|
1038
1038
|
)
|
1039
1039
|
primary_key_field = None
|
1040
|
-
|
1041
|
-
|
1042
|
-
is not None
|
1043
|
-
):
|
1040
|
+
records = results_df.to_dict("records")
|
1041
|
+
if (self._streams_dict[stream_name].stream.source_defined_primary_key is not None):
|
1044
1042
|
primary_key_field = self._streams_dict[stream_name].stream.source_defined_primary_key
|
1045
1043
|
elif self._streams_dict[stream_name].primary_key_field is not None:
|
1046
1044
|
primary_key_field = self._streams_dict[stream_name].primary_key_field
|
1047
1045
|
else:
|
1048
1046
|
results_df["APP_IDENTIFIER"] = None
|
1049
1047
|
if primary_key_field is not None:
|
1048
|
+
# the primary key field could contain a nested field, so we need to check for that
|
1050
1049
|
# we need to check that each record in the results contains the primary key field
|
1051
1050
|
if not all(
|
1052
1051
|
primary_key_field in record["RECORD_DATA"]
|
1053
|
-
for record in
|
1052
|
+
for record in records
|
1054
1053
|
):
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1054
|
+
if "." in primary_key_field:
|
1055
|
+
primary_key_field = primary_key_field.split(".")
|
1056
|
+
|
1057
|
+
if not all(
|
1058
|
+
get_nested_value(record["RECORD_DATA"], primary_key_field)
|
1059
|
+
for record in records
|
1060
|
+
):
|
1061
|
+
raise ValueError(
|
1062
|
+
f"Primary key field '{primary_key_field}' was not present in all records for stream {stream_name}"
|
1063
|
+
)
|
1064
|
+
else:
|
1065
|
+
raise ValueError(
|
1066
|
+
f"Primary key field '{primary_key_field}' was not present in all records for stream {stream_name}"
|
1067
|
+
)
|
1058
1068
|
|
1059
|
-
results_df["APP_IDENTIFIER"] = results_df["RECORD_DATA"].apply(
|
1060
|
-
lambda x: x[primary_key_field]
|
1061
|
-
)
|
1069
|
+
results_df["APP_IDENTIFIER"] = results_df["RECORD_DATA"].apply(lambda x: get_nested_value(x,primary_key_field))
|
1062
1070
|
# the timestamps in Snowflake are TIMESTAMP_LTZ, so we upload in string format to ensure the
|
1063
1071
|
# timezone information is present.
|
1064
1072
|
results_df["RETRIEVE_DATE"] = str(datetime.datetime.now().astimezone())
|
@@ -1786,4 +1794,10 @@ def remove_empty_dict_values(data: Dict) -> Dict:
|
|
1786
1794
|
for k, v in data.items()
|
1787
1795
|
if v != {}
|
1788
1796
|
}
|
1789
|
-
return data
|
1797
|
+
return data
|
1798
|
+
|
1799
|
+
def get_nested_value(nested_dict:Dict, keys:List[str]):
|
1800
|
+
"""
|
1801
|
+
Gets a value from a nested dictionary, using a list of keys to traverse the structure.
|
1802
|
+
"""
|
1803
|
+
return reduce(lambda d, key: d.get(key) if isinstance(d, dict) else None, keys, nested_dict)
|
@@ -1,12 +1,12 @@
|
|
1
1
|
omnata_plugin_runtime/__init__.py,sha256=w63LVME5nY-hQ4BBzfacy9kvTunwqHGs8iiSPGAX2ns,1214
|
2
2
|
omnata_plugin_runtime/api.py,sha256=vKq7goVPX5cPQ9CVN9l8RmpJDcqDwS5y9v1IWhWjBbk,6024
|
3
3
|
omnata_plugin_runtime/configuration.py,sha256=NICse7qMtReIYY4ZCu8ng4QDJ4rFP0g3mZwc8m1Xl54,32247
|
4
|
-
omnata_plugin_runtime/forms.py,sha256=
|
4
|
+
omnata_plugin_runtime/forms.py,sha256=_KqSMQG749wImLKxPZh3B3doTZMbP5jDvF6BhQNkPCM,17375
|
5
5
|
omnata_plugin_runtime/logging.py,sha256=Q6eSqrr3SzwfVAg4r4sV1dlxeNS_PzOtZfieoWUEOZQ,3232
|
6
|
-
omnata_plugin_runtime/omnata_plugin.py,sha256=
|
6
|
+
omnata_plugin_runtime/omnata_plugin.py,sha256=VyiRQ6SwsYUUCsEcFzMQE9AfjZkEsPLgx8h9syF5eaE,85259
|
7
7
|
omnata_plugin_runtime/plugin_entrypoints.py,sha256=dV_JOEWffdkAkofFYJMAsM_-gE9OpM2-paI2dsh5Rzo,24352
|
8
8
|
omnata_plugin_runtime/rate_limiting.py,sha256=QO8VB1H8al6a8-ydohUmL0c5JynXG2bulmuPRs2-2-Y,14910
|
9
|
-
omnata_plugin_runtime-0.2.
|
10
|
-
omnata_plugin_runtime-0.2.
|
11
|
-
omnata_plugin_runtime-0.2.
|
12
|
-
omnata_plugin_runtime-0.2.
|
9
|
+
omnata_plugin_runtime-0.2.66.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
|
10
|
+
omnata_plugin_runtime-0.2.66.dist-info/METADATA,sha256=daSdozbRb7rcP1mqGDbHj7-CKANyWnZu8QVPAfJGDiQ,1086
|
11
|
+
omnata_plugin_runtime-0.2.66.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
12
|
+
omnata_plugin_runtime-0.2.66.dist-info/RECORD,,
|
File without changes
|
File without changes
|