omnata-plugin-runtime 0.3.21a64__py3-none-any.whl → 0.3.22a65__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/omnata_plugin.py +38 -20
- {omnata_plugin_runtime-0.3.21a64.dist-info → omnata_plugin_runtime-0.3.22a65.dist-info}/METADATA +1 -1
- {omnata_plugin_runtime-0.3.21a64.dist-info → omnata_plugin_runtime-0.3.22a65.dist-info}/RECORD +5 -5
- {omnata_plugin_runtime-0.3.21a64.dist-info → omnata_plugin_runtime-0.3.22a65.dist-info}/LICENSE +0 -0
- {omnata_plugin_runtime-0.3.21a64.dist-info → omnata_plugin_runtime-0.3.22a65.dist-info}/WHEEL +0 -0
@@ -1181,29 +1181,47 @@ class InboundSyncRequest(SyncRequest):
|
|
1181
1181
|
else:
|
1182
1182
|
results_df["APP_IDENTIFIER"] = None
|
1183
1183
|
if primary_key_field is not None:
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1184
|
+
if isinstance(list,primary_key_field):
|
1185
|
+
primary_key_fields = cast(List[str],primary_key_field)
|
1186
|
+
primary_key_fields = sorted(primary_key_fields)
|
1187
|
+
# handle the sitation where the primary key is a list of fields
|
1188
|
+
# first, check that all records contain all of the primary key fields
|
1189
|
+
if not all(
|
1190
|
+
all(
|
1191
|
+
field in record["RECORD_DATA"]
|
1192
|
+
for field in primary_key_fields
|
1193
|
+
)
|
1194
|
+
for record in records
|
1195
|
+
):
|
1196
|
+
raise ValueError(
|
1197
|
+
f"Primary key fields '{primary_key_fields}' were not present in all records for stream {stream_name}"
|
1198
|
+
)
|
1199
|
+
# concatenate the primary key fields to form the APP_IDENTIFIER
|
1200
|
+
results_df["APP_IDENTIFIER"] = results_df["RECORD_DATA"].apply(lambda x: "-".join([str(field) for field in primary_key_fields]))
|
1201
|
+
else:
|
1202
|
+
# the primary key field could contain a nested field, so we need to check for that
|
1203
|
+
# we need to check that each record in the results contains the primary key field
|
1204
|
+
if not all(
|
1205
|
+
primary_key_field in record["RECORD_DATA"]
|
1206
|
+
for record in records
|
1207
|
+
):
|
1208
|
+
if "." in primary_key_field:
|
1209
|
+
primary_key_field = primary_key_field.split(".")
|
1210
|
+
|
1211
|
+
if not all(
|
1212
|
+
get_nested_value(record["RECORD_DATA"], primary_key_field)
|
1213
|
+
for record in records
|
1214
|
+
):
|
1215
|
+
raise ValueError(
|
1216
|
+
f"Primary key field '{primary_key_field}' was not present in all records for stream {stream_name}"
|
1217
|
+
)
|
1218
|
+
else:
|
1197
1219
|
raise ValueError(
|
1198
1220
|
f"Primary key field '{primary_key_field}' was not present in all records for stream {stream_name}"
|
1199
1221
|
)
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
)
|
1204
|
-
# TODO: handle the scenario where the primary key field is a list, and concatenate the values to form the APP_IDENTIFIER
|
1205
|
-
# Currently this is only implemented in the java runtime, since it's typically databases that use composite keys
|
1206
|
-
results_df["APP_IDENTIFIER"] = results_df["RECORD_DATA"].apply(lambda x: get_nested_value(dict(x),primary_key_field))
|
1222
|
+
# TODO: handle the scenario where the primary key field is a list, and concatenate the values to form the APP_IDENTIFIER
|
1223
|
+
# Currently this is only implemented in the java runtime, since it's typically databases that use composite keys
|
1224
|
+
results_df["APP_IDENTIFIER"] = results_df["RECORD_DATA"].apply(lambda x: get_nested_value(dict(x),primary_key_field))
|
1207
1225
|
# ensure APP_IDENTIFIER is a string
|
1208
1226
|
results_df["APP_IDENTIFIER"] = results_df["APP_IDENTIFIER"].apply(str)
|
1209
1227
|
# the timestamps in Snowflake are TIMESTAMP_LTZ, so we upload in string format to ensure the
|
{omnata_plugin_runtime-0.3.21a64.dist-info → omnata_plugin_runtime-0.3.22a65.dist-info}/RECORD
RENAMED
@@ -3,10 +3,10 @@ omnata_plugin_runtime/api.py,sha256=_N5ok5LN7GDO4J9n3yduXp3tpjmhpySY__U2baiygrs,
|
|
3
3
|
omnata_plugin_runtime/configuration.py,sha256=7cMekoY8CeZAJHpASU6tCMidF55Hzfr7CD74jtebqIY,35742
|
4
4
|
omnata_plugin_runtime/forms.py,sha256=pw_aKVsXSz47EP8PFBI3VDwdSN5IjvZxp8JTjO1V130,18421
|
5
5
|
omnata_plugin_runtime/logging.py,sha256=bn7eKoNWvtuyTk7RTwBS9UARMtqkiICtgMtzq3KA2V0,3272
|
6
|
-
omnata_plugin_runtime/omnata_plugin.py,sha256=
|
6
|
+
omnata_plugin_runtime/omnata_plugin.py,sha256=edBoEUjYoHO6V1MQLGtzWLG2s1mpmo2WsK0YhVCwI2Y,102159
|
7
7
|
omnata_plugin_runtime/plugin_entrypoints.py,sha256=s-SrUnXaS6FaBq1igiJhcCB3Md_a6op-dp_g1H_55QU,27736
|
8
8
|
omnata_plugin_runtime/rate_limiting.py,sha256=se6MftQI5NrVHaLb1hByPCgAESPQhkAgIG7KIU1clDU,16562
|
9
|
-
omnata_plugin_runtime-0.3.
|
10
|
-
omnata_plugin_runtime-0.3.
|
11
|
-
omnata_plugin_runtime-0.3.
|
12
|
-
omnata_plugin_runtime-0.3.
|
9
|
+
omnata_plugin_runtime-0.3.22a65.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
|
10
|
+
omnata_plugin_runtime-0.3.22a65.dist-info/METADATA,sha256=2VFI7Q022gTSQcIxoFABxhhJoj2nOeqV8W1XCXRLTfo,1604
|
11
|
+
omnata_plugin_runtime-0.3.22a65.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
12
|
+
omnata_plugin_runtime-0.3.22a65.dist-info/RECORD,,
|
{omnata_plugin_runtime-0.3.21a64.dist-info → omnata_plugin_runtime-0.3.22a65.dist-info}/LICENSE
RENAMED
File without changes
|
{omnata_plugin_runtime-0.3.21a64.dist-info → omnata_plugin_runtime-0.3.22a65.dist-info}/WHEEL
RENAMED
File without changes
|