omnata-plugin-runtime 0.5.7a135__py3-none-any.whl → 0.5.7a137__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.
@@ -2250,20 +2250,25 @@ def consumer_udtf(
2250
2250
  result_columns: List[SnowflakeUDTFResultColumn]):
2251
2251
  def class_decorator(cls):
2252
2252
  # Get the original 'process' method from the class
2253
- cls._is_omnata_consumer_udtf = True
2254
2253
  original_process = getattr(cls, 'process')
2255
2254
  sig = signature(original_process)
2256
2255
  params = sig.parameters
2257
-
2256
+ if len(params) < 2:
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
- if list(params.keys())[0] != 'self':
2260
- raise ValueError("The first argument should be 'self' for class methods.")
2259
+ first_param_name = list(params.keys())[0]
2261
2260
 
2262
- if list(params.keys())[1] != 'connection_parameters':
2263
- raise ValueError("The second argument should be 'connection_parameters'.")
2264
-
2265
- if params[list(params.keys())[1]].annotation != Dict:
2266
- raise ValueError("The second argument must be a dict.")
2261
+ if first_param_name != 'self':
2262
+ raise ValueError(f"The first argument should be 'self', instead it was '{first_param_name}'.")
2263
+
2264
+ second_param_name = list(params.keys())[1]
2265
+
2266
+ if second_param_name != 'connection_parameters':
2267
+ raise ValueError(f"The second argument should be 'connection_parameters', instead it was {second_param_name}.")
2268
+
2269
+
2270
+ if params[second_param_name].annotation != ConnectionConfigurationParameters:
2271
+ raise ValueError(f"The second argument must be a ConnectionConfigurationParameters, instead it was a {params[second_param_name].annotation}.")
2267
2272
 
2268
2273
  @wraps(original_process)
2269
2274
  def wrapped_process(self, connection_parameters, *args, **kwargs):
@@ -2289,7 +2294,10 @@ def consumer_udtf(
2289
2294
  return original_process(self, parameters, *args, **kwargs)
2290
2295
  # Replace the original 'process' method with the wrapped version
2291
2296
  setattr(cls, 'process', wrapped_process)
2292
-
2297
+ cls._is_omnata_consumer_udtf = True
2298
+ cls._omnata_consumer_udtf_description = description
2299
+ cls._omnata_consumer_udtf_params = params
2300
+ cls._omnata_consumer_udtf_result_columns = result_columns
2293
2301
  return cls
2294
2302
 
2295
2303
  return class_decorator
@@ -2321,12 +2329,14 @@ def consumer_udf(
2321
2329
  def decorator(func):
2322
2330
  sig = signature(func)
2323
2331
  params = sig.parameters
2324
-
2332
+ if len(params) == 0:
2333
+ raise ValueError("The function must have at least one parameter.")
2325
2334
  # Ensure the first argument is mandatory and positional
2326
- if list(params.keys())[0] != 'connection_parameters':
2327
- raise ValueError("The first argument should be 'connection_parameters'.")
2328
- if params[list(params.keys())[0]].annotation != Dict:
2329
- raise ValueError("The first argument must be a dict.")
2335
+ first_param_name = list(params.keys())[0]
2336
+ if first_param_name != 'connection_parameters':
2337
+ raise ValueError(f"The first argument should be 'connection_parameters', instead it was '{first_param_name}'.")
2338
+ if params[first_param_name].annotation != ConnectionConfigurationParameters:
2339
+ raise ValueError(f"The first argument must be a ConnectionConfigurationParameters, instead it was a {params[first_param_name].annotation}.")
2330
2340
 
2331
2341
  @wraps(func)
2332
2342
  def wrapper(self, connection_parameters, *args, **kwargs):
@@ -2353,6 +2363,9 @@ def consumer_udf(
2353
2363
  return func(parameters, *args, **kwargs)
2354
2364
 
2355
2365
  wrapper._is_omnata_consumer_udf = True
2366
+ wrapper._omnata_consumer_udf_description = description
2367
+ wrapper._omnata_consumer_udf_params = params
2368
+ wrapper._omnata_consumer_udf_result_data_type = result_data_type
2356
2369
  return wrapper
2357
2370
 
2358
2371
  return decorator
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.5.7a135
3
+ Version: 0.5.7a137
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
@@ -3,10 +3,10 @@ omnata_plugin_runtime/api.py,sha256=FxzTqri4no8ClkOm7vZADG8aD47jcGBCTTQDEORmOJM,
3
3
  omnata_plugin_runtime/configuration.py,sha256=TI6GaVFhewVawBCaYN34GujY57qEP6q2nik4YpSEk5s,38100
4
4
  omnata_plugin_runtime/forms.py,sha256=GzSPEwcijsoPCXEO1mHiE8ylvX_KSE5TkhwqkymA2Ss,19755
5
5
  omnata_plugin_runtime/logging.py,sha256=bn7eKoNWvtuyTk7RTwBS9UARMtqkiICtgMtzq3KA2V0,3272
6
- omnata_plugin_runtime/omnata_plugin.py,sha256=-u_v8EboxbwkiYw6AcmeJfvuYEI7eWcQ5bSjRUeH8kg,118053
6
+ omnata_plugin_runtime/omnata_plugin.py,sha256=EkDRpFXVMbn-tJGYQk6Mn1DSd5YdDOuzkTmT5WjOh4E,119125
7
7
  omnata_plugin_runtime/plugin_entrypoints.py,sha256=PFSLsYEVnWHVvSoOYTtTK2JY6pp6_8_eYP53WqLRiPE,27975
8
8
  omnata_plugin_runtime/rate_limiting.py,sha256=DVQ_bc-mVLBkrU1PTns1MWXhHiLpSB5HkWCcdePtJ2A,25611
9
- omnata_plugin_runtime-0.5.7a135.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
10
- omnata_plugin_runtime-0.5.7a135.dist-info/METADATA,sha256=nGKtINdFnVmfWvG119LLVku-fh93V62sMatfuNkIU9k,1985
11
- omnata_plugin_runtime-0.5.7a135.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
12
- omnata_plugin_runtime-0.5.7a135.dist-info/RECORD,,
9
+ omnata_plugin_runtime-0.5.7a137.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
10
+ omnata_plugin_runtime-0.5.7a137.dist-info/METADATA,sha256=5ZnIFAJ4_7b_8SW7iIVgPnkU90P8nQpvjT9p5-VjdeY,1985
11
+ omnata_plugin_runtime-0.5.7a137.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
12
+ omnata_plugin_runtime-0.5.7a137.dist-info/RECORD,,