omnata-plugin-runtime 0.5.7a145__tar.gz → 0.5.7a147__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {omnata_plugin_runtime-0.5.7a145 → omnata_plugin_runtime-0.5.7a147}/PKG-INFO +1 -1
- {omnata_plugin_runtime-0.5.7a145 → omnata_plugin_runtime-0.5.7a147}/pyproject.toml +1 -1
- {omnata_plugin_runtime-0.5.7a145 → omnata_plugin_runtime-0.5.7a147}/src/omnata_plugin_runtime/omnata_plugin.py +42 -32
- {omnata_plugin_runtime-0.5.7a145 → omnata_plugin_runtime-0.5.7a147}/LICENSE +0 -0
- {omnata_plugin_runtime-0.5.7a145 → omnata_plugin_runtime-0.5.7a147}/README.md +0 -0
- {omnata_plugin_runtime-0.5.7a145 → omnata_plugin_runtime-0.5.7a147}/src/omnata_plugin_runtime/__init__.py +0 -0
- {omnata_plugin_runtime-0.5.7a145 → omnata_plugin_runtime-0.5.7a147}/src/omnata_plugin_runtime/api.py +0 -0
- {omnata_plugin_runtime-0.5.7a145 → omnata_plugin_runtime-0.5.7a147}/src/omnata_plugin_runtime/configuration.py +0 -0
- {omnata_plugin_runtime-0.5.7a145 → omnata_plugin_runtime-0.5.7a147}/src/omnata_plugin_runtime/forms.py +0 -0
- {omnata_plugin_runtime-0.5.7a145 → omnata_plugin_runtime-0.5.7a147}/src/omnata_plugin_runtime/logging.py +0 -0
- {omnata_plugin_runtime-0.5.7a145 → omnata_plugin_runtime-0.5.7a147}/src/omnata_plugin_runtime/plugin_entrypoints.py +0 -0
- {omnata_plugin_runtime-0.5.7a145 → omnata_plugin_runtime-0.5.7a147}/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-a147"
|
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"
|
@@ -2253,19 +2253,21 @@ class SnowflakeUDTFResultColumn:
|
|
2253
2253
|
"""
|
2254
2254
|
name: str
|
2255
2255
|
data_type: str
|
2256
|
-
|
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
|
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
|
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
|
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
|
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.
|
2424
|
-
cls.
|
2425
|
-
cls.
|
2426
|
-
cls.
|
2427
|
-
cls.
|
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
|
2438
|
+
def find_udtf_classes(path:str = '.') -> List[PythonUDTFDefinition | JavaUDTFDefinition]:
|
2433
2439
|
"""
|
2434
|
-
Finds all classes in the specified directory which have the '
|
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, '
|
2456
|
+
if hasattr(obj, '_is_omnata_udtf'):
|
2451
2457
|
matching_classes.append(PythonUDTFDefinition(
|
2452
|
-
name=obj.
|
2453
|
-
description=obj.
|
2454
|
-
params=obj.
|
2455
|
-
result_columns=obj.
|
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
|
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.
|
2509
|
-
wrapper.
|
2510
|
-
wrapper.
|
2511
|
-
wrapper.
|
2512
|
-
wrapper.
|
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
|
2526
|
+
def find_udf_functions(path:str = '.') -> List[PythonUDFDefinition | JavaUDFDefinition]:
|
2518
2527
|
"""
|
2519
|
-
Finds all functions in the specified directory which have the '
|
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, '
|
2544
|
+
if hasattr(obj, '_is_omnata_udf'):
|
2536
2545
|
matching_classes.append(PythonUDFDefinition(
|
2537
|
-
name=obj.
|
2538
|
-
description=obj.
|
2539
|
-
params=obj.
|
2540
|
-
result_data_type=obj.
|
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
|
))
|
File without changes
|
File without changes
|
File without changes
|
{omnata_plugin_runtime-0.5.7a145 → omnata_plugin_runtime-0.5.7a147}/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
|