omnata-plugin-runtime 0.5.7a137__tar.gz → 0.5.7a139__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {omnata_plugin_runtime-0.5.7a137 → omnata_plugin_runtime-0.5.7a139}/PKG-INFO +1 -1
- {omnata_plugin_runtime-0.5.7a137 → omnata_plugin_runtime-0.5.7a139}/pyproject.toml +1 -1
- {omnata_plugin_runtime-0.5.7a137 → omnata_plugin_runtime-0.5.7a139}/src/omnata_plugin_runtime/omnata_plugin.py +15 -12
- {omnata_plugin_runtime-0.5.7a137 → omnata_plugin_runtime-0.5.7a139}/LICENSE +0 -0
- {omnata_plugin_runtime-0.5.7a137 → omnata_plugin_runtime-0.5.7a139}/README.md +0 -0
- {omnata_plugin_runtime-0.5.7a137 → omnata_plugin_runtime-0.5.7a139}/src/omnata_plugin_runtime/__init__.py +0 -0
- {omnata_plugin_runtime-0.5.7a137 → omnata_plugin_runtime-0.5.7a139}/src/omnata_plugin_runtime/api.py +0 -0
- {omnata_plugin_runtime-0.5.7a137 → omnata_plugin_runtime-0.5.7a139}/src/omnata_plugin_runtime/configuration.py +0 -0
- {omnata_plugin_runtime-0.5.7a137 → omnata_plugin_runtime-0.5.7a139}/src/omnata_plugin_runtime/forms.py +0 -0
- {omnata_plugin_runtime-0.5.7a137 → omnata_plugin_runtime-0.5.7a139}/src/omnata_plugin_runtime/logging.py +0 -0
- {omnata_plugin_runtime-0.5.7a137 → omnata_plugin_runtime-0.5.7a139}/src/omnata_plugin_runtime/plugin_entrypoints.py +0 -0
- {omnata_plugin_runtime-0.5.7a137 → omnata_plugin_runtime-0.5.7a139}/src/omnata_plugin_runtime/rate_limiting.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "omnata-plugin-runtime"
|
3
|
-
version = "0.5.7-
|
3
|
+
version = "0.5.7-a139"
|
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"
|
@@ -2235,7 +2235,6 @@ class SnowflakeFunctionParameter:
|
|
2235
2235
|
name: str
|
2236
2236
|
description: str
|
2237
2237
|
data_type: str
|
2238
|
-
has_default_value: bool = False
|
2239
2238
|
default_value_clause: Optional[str] = None
|
2240
2239
|
|
2241
2240
|
@dataclass
|
@@ -2245,6 +2244,7 @@ class SnowflakeUDTFResultColumn:
|
|
2245
2244
|
description: str
|
2246
2245
|
|
2247
2246
|
def consumer_udtf(
|
2247
|
+
name:str,
|
2248
2248
|
description: str,
|
2249
2249
|
params: List[SnowflakeFunctionParameter],
|
2250
2250
|
result_columns: List[SnowflakeUDTFResultColumn]):
|
@@ -2252,23 +2252,23 @@ def consumer_udtf(
|
|
2252
2252
|
# Get the original 'process' method from the class
|
2253
2253
|
original_process = getattr(cls, 'process')
|
2254
2254
|
sig = signature(original_process)
|
2255
|
-
|
2256
|
-
if len(
|
2255
|
+
function_params = sig.parameters
|
2256
|
+
if len(function_params) < 2:
|
2257
2257
|
raise ValueError("The function must have the self parameter, plus at least the mandatory 'connection_parameters' parameter.")
|
2258
2258
|
# Ensure the first argument is mandatory and positional
|
2259
|
-
first_param_name = list(
|
2259
|
+
first_param_name = list(function_params.keys())[0]
|
2260
2260
|
|
2261
2261
|
if first_param_name != 'self':
|
2262
2262
|
raise ValueError(f"The first argument should be 'self', instead it was '{first_param_name}'.")
|
2263
2263
|
|
2264
|
-
second_param_name = list(
|
2264
|
+
second_param_name = list(function_params.keys())[1]
|
2265
2265
|
|
2266
2266
|
if second_param_name != 'connection_parameters':
|
2267
2267
|
raise ValueError(f"The second argument should be 'connection_parameters', instead it was {second_param_name}.")
|
2268
2268
|
|
2269
2269
|
|
2270
|
-
if
|
2271
|
-
raise ValueError(f"The second argument must be a ConnectionConfigurationParameters, instead it was a {
|
2270
|
+
if function_params[second_param_name].annotation != ConnectionConfigurationParameters:
|
2271
|
+
raise ValueError(f"The second argument must be a ConnectionConfigurationParameters, instead it was a {function_params[second_param_name].annotation}.")
|
2272
2272
|
|
2273
2273
|
@wraps(original_process)
|
2274
2274
|
def wrapped_process(self, connection_parameters, *args, **kwargs):
|
@@ -2295,6 +2295,7 @@ def consumer_udtf(
|
|
2295
2295
|
# Replace the original 'process' method with the wrapped version
|
2296
2296
|
setattr(cls, 'process', wrapped_process)
|
2297
2297
|
cls._is_omnata_consumer_udtf = True
|
2298
|
+
cls._omnata_consumer_udtf_name = name
|
2298
2299
|
cls._omnata_consumer_udtf_description = description
|
2299
2300
|
cls._omnata_consumer_udtf_params = params
|
2300
2301
|
cls._omnata_consumer_udtf_result_columns = result_columns
|
@@ -2323,20 +2324,21 @@ def find_consumer_udtf_classes(path:str = '.'):
|
|
2323
2324
|
|
2324
2325
|
|
2325
2326
|
def consumer_udf(
|
2327
|
+
name: str,
|
2326
2328
|
description: str,
|
2327
2329
|
params: List[SnowflakeFunctionParameter],
|
2328
2330
|
result_data_type: str):
|
2329
2331
|
def decorator(func):
|
2330
2332
|
sig = signature(func)
|
2331
|
-
|
2332
|
-
if len(
|
2333
|
+
function_params = sig.parameters
|
2334
|
+
if len(function_params) == 0:
|
2333
2335
|
raise ValueError("The function must have at least one parameter.")
|
2334
2336
|
# Ensure the first argument is mandatory and positional
|
2335
|
-
first_param_name = list(
|
2337
|
+
first_param_name = list(function_params.keys())[0]
|
2336
2338
|
if first_param_name != 'connection_parameters':
|
2337
2339
|
raise ValueError(f"The first argument should be 'connection_parameters', instead it was '{first_param_name}'.")
|
2338
|
-
if
|
2339
|
-
raise ValueError(f"The first argument must be a ConnectionConfigurationParameters, instead it was a {
|
2340
|
+
if function_params[first_param_name].annotation != ConnectionConfigurationParameters:
|
2341
|
+
raise ValueError(f"The first argument must be a ConnectionConfigurationParameters, instead it was a {function_params[first_param_name].annotation}.")
|
2340
2342
|
|
2341
2343
|
@wraps(func)
|
2342
2344
|
def wrapper(self, connection_parameters, *args, **kwargs):
|
@@ -2363,6 +2365,7 @@ def consumer_udf(
|
|
2363
2365
|
return func(parameters, *args, **kwargs)
|
2364
2366
|
|
2365
2367
|
wrapper._is_omnata_consumer_udf = True
|
2368
|
+
wrapper._omnata_consumer_udf_name = name
|
2366
2369
|
wrapper._omnata_consumer_udf_description = description
|
2367
2370
|
wrapper._omnata_consumer_udf_params = params
|
2368
2371
|
wrapper._omnata_consumer_udf_result_data_type = result_data_type
|
File without changes
|
File without changes
|
File without changes
|
{omnata_plugin_runtime-0.5.7a137 → omnata_plugin_runtime-0.5.7a139}/src/omnata_plugin_runtime/api.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|