omnata-plugin-runtime 0.5.7a145__py3-none-any.whl → 0.5.7a147__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.
@@ -2253,19 +2253,21 @@ class SnowflakeUDTFResultColumn:
2253
2253
  """
2254
2254
  name: str
2255
2255
  data_type: str
2256
- description: str
2256
+ def __str__(self):
2257
+ return f"{self.name} {self.data_type}"
2257
2258
 
2258
2259
  @dataclass
2259
2260
  class PythonUDTFDefinition:
2260
2261
  """
2261
2262
  The information needed by the plugin uploader to put a Python UDTF definition into the setup script.
2262
- Do not use this class directly in plugins, instead use the consumer_udtf decorator.
2263
+ Do not use this class directly in plugins, instead use the omnata_udtf decorator.
2263
2264
  """
2264
2265
  name: str
2265
2266
  description: str
2266
2267
  params: List[SnowflakeFunctionParameter]
2267
2268
  result_columns: List[SnowflakeUDTFResultColumn]
2268
2269
  handler: str
2270
+ expose_to_consumer: bool
2269
2271
  packages: Optional[List[str]] = None
2270
2272
 
2271
2273
  def __str__(self):
@@ -2317,13 +2319,14 @@ HANDLER='{self.handler}';
2317
2319
  class PythonUDFDefinition:
2318
2320
  """
2319
2321
  The information needed by the plugin uploader to put a Python UDF definition into the setup script.
2320
- Do not use this class directly in plugins, instead use the consumer_udf decorator.
2322
+ Do not use this class directly in plugins, instead use the omnata_udf decorator.
2321
2323
  """
2322
2324
  name: str
2323
2325
  description: str
2324
2326
  params: List[SnowflakeFunctionParameter]
2325
2327
  result_data_type: str
2326
2328
  handler: str
2329
+ expose_to_consumer: bool
2327
2330
  packages: Optional[List[str]] = None
2328
2331
 
2329
2332
  def __str__(self):
@@ -2351,6 +2354,7 @@ class JavaUDFDefinition:
2351
2354
  packages: List[str]
2352
2355
  imports: List[str]
2353
2356
  handler: str
2357
+ expose_to_consumer: bool
2354
2358
 
2355
2359
  def __str__(self):
2356
2360
  param_str = ', '.join([str(param) for param in self.params])
@@ -2366,13 +2370,14 @@ IMPORTS = ({imports_str})
2366
2370
  HANDLER='{self.handler}';
2367
2371
  """
2368
2372
 
2369
- def consumer_udtf(
2373
+ def omnata_udtf(
2370
2374
  name:str,
2371
2375
  description: str,
2372
2376
  params: List[SnowflakeFunctionParameter],
2373
- result_columns: List[SnowflakeUDTFResultColumn]):
2377
+ result_columns: List[SnowflakeUDTFResultColumn],
2378
+ expose_to_consumer: bool):
2374
2379
  """
2375
- A decorator for a class which should be automatically exposed to the consumer as a UDTF
2380
+ A decorator for a class which should create a UDTF in the UDFS schema of the native app
2376
2381
  """
2377
2382
  def class_decorator(cls):
2378
2383
  # Get the original 'process' method from the class
@@ -2420,18 +2425,19 @@ def consumer_udtf(
2420
2425
  return original_process(self, parameters, *args, **kwargs)
2421
2426
  # Replace the original 'process' method with the wrapped version
2422
2427
  setattr(cls, 'process', wrapped_process)
2423
- cls._is_omnata_consumer_udtf = True
2424
- cls._omnata_consumer_udtf_name = name
2425
- cls._omnata_consumer_udtf_description = description
2426
- cls._omnata_consumer_udtf_params = params
2427
- cls._omnata_consumer_udtf_result_columns = result_columns
2428
+ cls._is_omnata_udtf = True
2429
+ cls._omnata_udtf_name = name
2430
+ cls._omnata_udtf_description = description
2431
+ cls._omnata_udtf_params = params
2432
+ cls._omnata_udtf_result_columns = result_columns
2433
+ cls._omnata_udtf_expose_to_consumer = expose_to_consumer
2428
2434
  return cls
2429
2435
 
2430
2436
  return class_decorator
2431
2437
 
2432
- def find_consumer_udtf_classes(path:str = '.') -> List[PythonUDTFDefinition | JavaUDTFDefinition]:
2438
+ def find_udtf_classes(path:str = '.') -> List[PythonUDTFDefinition | JavaUDTFDefinition]:
2433
2439
  """
2434
- Finds all classes in the specified directory which have the 'consumer_udtf' decorator applied
2440
+ Finds all classes in the specified directory which have the 'omnata_udtf' decorator applied
2435
2441
  """
2436
2442
  # Get the directory's absolute path
2437
2443
  current_dir = os.path.abspath(path)
@@ -2447,12 +2453,13 @@ def find_consumer_udtf_classes(path:str = '.') -> List[PythonUDTFDefinition | Ja
2447
2453
  # Iterate over all members of the module
2448
2454
  for name, obj in inspect.getmembers(module, inspect.isclass):
2449
2455
  # Check if the class has the specified attribute
2450
- if hasattr(obj, '_is_omnata_consumer_udtf'):
2456
+ if hasattr(obj, '_is_omnata_udtf'):
2451
2457
  matching_classes.append(PythonUDTFDefinition(
2452
- name=obj._omnata_consumer_udtf_name,
2453
- description=obj._omnata_consumer_udtf_description,
2454
- params=obj._omnata_consumer_udtf_params,
2455
- result_columns=obj._omnata_consumer_udtf_result_columns,
2458
+ name=obj._omnata_udtf_name,
2459
+ description=obj._omnata_udtf_description,
2460
+ params=obj._omnata_udtf_params,
2461
+ result_columns=obj._omnata_udtf_result_columns,
2462
+ expose_to_consumer=obj._omnata_udtf_expose_to_consumer,
2456
2463
  handler=obj.__module__+'.'+obj.__name__
2457
2464
  ))
2458
2465
  elif isinstance(obj, JavaUDTFDefinition):
@@ -2461,11 +2468,12 @@ def find_consumer_udtf_classes(path:str = '.') -> List[PythonUDTFDefinition | Ja
2461
2468
  return matching_classes
2462
2469
 
2463
2470
 
2464
- def consumer_udf(
2471
+ def omnata_udf(
2465
2472
  name: str,
2466
2473
  description: str,
2467
2474
  params: List[SnowflakeFunctionParameter],
2468
- result_data_type: str):
2475
+ result_data_type: str,
2476
+ expose_to_consumer: bool):
2469
2477
  """
2470
2478
  A decorator for a function which should be automatically exposed to the consumer as a UDF
2471
2479
  """
@@ -2505,18 +2513,19 @@ def consumer_udf(
2505
2513
  # Pass the validated arguments to the function
2506
2514
  return func(parameters, *args, **kwargs)
2507
2515
 
2508
- wrapper._is_omnata_consumer_udf = True
2509
- wrapper._omnata_consumer_udf_name = name
2510
- wrapper._omnata_consumer_udf_description = description
2511
- wrapper._omnata_consumer_udf_params = params
2512
- wrapper._omnata_consumer_udf_result_data_type = result_data_type
2516
+ wrapper._is_omnata_udf = True
2517
+ wrapper._omnata_udf_name = name
2518
+ wrapper._omnata_udf_description = description
2519
+ wrapper._omnata_udf_params = params
2520
+ wrapper._omnata_udf_result_data_type = result_data_type
2521
+ wrapper._omnata_udf_expose_to_consumer = expose_to_consumer
2513
2522
  return wrapper
2514
2523
 
2515
2524
  return decorator
2516
2525
 
2517
- def find_consumer_udf_functions(path:str = '.') -> List[PythonUDFDefinition | JavaUDFDefinition]:
2526
+ def find_udf_functions(path:str = '.') -> List[PythonUDFDefinition | JavaUDFDefinition]:
2518
2527
  """
2519
- Finds all functions in the specified directory which have the 'consumer_udf' decorator applied
2528
+ Finds all functions in the specified directory which have the 'omnata_udf' decorator applied
2520
2529
  """
2521
2530
  # Get the current directory's absolute path
2522
2531
  current_dir = os.path.abspath(path)
@@ -2532,12 +2541,13 @@ def find_consumer_udf_functions(path:str = '.') -> List[PythonUDFDefinition | Ja
2532
2541
  # Iterate over all members of the module
2533
2542
  for name, obj in inspect.getmembers(module, inspect.isfunction):
2534
2543
  # Check if the class has the specified attribute
2535
- if hasattr(obj, '_is_omnata_consumer_udf'):
2544
+ if hasattr(obj, '_is_omnata_udf'):
2536
2545
  matching_classes.append(PythonUDFDefinition(
2537
- name=obj._omnata_consumer_udf_name,
2538
- description=obj._omnata_consumer_udf_description,
2539
- params=obj._omnata_consumer_udf_params,
2540
- result_data_type=obj._omnata_consumer_udf_result_data_type,
2546
+ name=obj._omnata_udf_name,
2547
+ description=obj._omnata_udf_description,
2548
+ params=obj._omnata_udf_params,
2549
+ result_data_type=obj._omnata_udf_result_data_type,
2550
+ expose_to_consumer=obj._omnata_udf_expose_to_consumer,
2541
2551
  packages=[],
2542
2552
  handler=obj.__module__+'.'+obj.__name__
2543
2553
  ))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.5.7a145
3
+ Version: 0.5.7a147
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=PVgyiqHCXXqsUIbLnOFe9H2FRZB7o_4FiI-9KHzRsfg,125045
6
+ omnata_plugin_runtime/omnata_plugin.py,sha256=mgGxL7W2tnKGUUW6uUYBRYNabhu5sJVCf1y3GX-eJ3o,125323
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.7a145.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
10
- omnata_plugin_runtime-0.5.7a145.dist-info/METADATA,sha256=CjSBdW5cKSIrQ1iKBJ3krdVJy6RHqzAAD4b2g44nik4,1985
11
- omnata_plugin_runtime-0.5.7a145.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
12
- omnata_plugin_runtime-0.5.7a145.dist-info/RECORD,,
9
+ omnata_plugin_runtime-0.5.7a147.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
10
+ omnata_plugin_runtime-0.5.7a147.dist-info/METADATA,sha256=_6tMzoqnFJM3jV4Lomk7A2vJselwa5YiiaoBzFRtMUw,1985
11
+ omnata_plugin_runtime-0.5.7a147.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
12
+ omnata_plugin_runtime-0.5.7a147.dist-info/RECORD,,