omnata-plugin-runtime 0.5.7a139__py3-none-any.whl → 0.5.7a141__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- omnata_plugin_runtime/omnata_plugin.py +26 -2
- {omnata_plugin_runtime-0.5.7a139.dist-info → omnata_plugin_runtime-0.5.7a141.dist-info}/METADATA +1 -1
- {omnata_plugin_runtime-0.5.7a139.dist-info → omnata_plugin_runtime-0.5.7a141.dist-info}/RECORD +5 -5
- {omnata_plugin_runtime-0.5.7a139.dist-info → omnata_plugin_runtime-0.5.7a141.dist-info}/LICENSE +0 -0
- {omnata_plugin_runtime-0.5.7a139.dist-info → omnata_plugin_runtime-0.5.7a141.dist-info}/WHEEL +0 -0
@@ -6,6 +6,7 @@ Includes data container classes and defines the contract for a plugin.
|
|
6
6
|
from __future__ import annotations
|
7
7
|
from inspect import signature
|
8
8
|
import sys
|
9
|
+
from types import FunctionType
|
9
10
|
from typing import Union
|
10
11
|
if tuple(sys.version_info[:2]) >= (3, 9):
|
11
12
|
# Python 3.9 and above
|
@@ -2232,13 +2233,24 @@ def get_nested_value(nested_dict:Dict, keys:List[str]):
|
|
2232
2233
|
|
2233
2234
|
@dataclass
|
2234
2235
|
class SnowflakeFunctionParameter:
|
2236
|
+
"""
|
2237
|
+
Represents a parameter for a Snowflake UDF or UDTF
|
2238
|
+
"""
|
2235
2239
|
name: str
|
2236
2240
|
description: str
|
2237
2241
|
data_type: str
|
2238
2242
|
default_value_clause: Optional[str] = None
|
2239
2243
|
|
2244
|
+
def __str__(self):
|
2245
|
+
if self.default_value_clause:
|
2246
|
+
return f"{self.name} {self.data_type} default {self.default_value_clause}"
|
2247
|
+
return f"{self.name} {self.data_type}"
|
2248
|
+
|
2240
2249
|
@dataclass
|
2241
2250
|
class SnowflakeUDTFResultColumn:
|
2251
|
+
"""
|
2252
|
+
Represents a result column for a Snowflake UDTF
|
2253
|
+
"""
|
2242
2254
|
name: str
|
2243
2255
|
data_type: str
|
2244
2256
|
description: str
|
@@ -2248,6 +2260,9 @@ def consumer_udtf(
|
|
2248
2260
|
description: str,
|
2249
2261
|
params: List[SnowflakeFunctionParameter],
|
2250
2262
|
result_columns: List[SnowflakeUDTFResultColumn]):
|
2263
|
+
"""
|
2264
|
+
A decorator for a class which should be automatically exposed to the consumer as a UDTF
|
2265
|
+
"""
|
2251
2266
|
def class_decorator(cls):
|
2252
2267
|
# Get the original 'process' method from the class
|
2253
2268
|
original_process = getattr(cls, 'process')
|
@@ -2303,7 +2318,10 @@ def consumer_udtf(
|
|
2303
2318
|
|
2304
2319
|
return class_decorator
|
2305
2320
|
|
2306
|
-
def find_consumer_udtf_classes(path:str = '.'):
|
2321
|
+
def find_consumer_udtf_classes(path:str = '.') -> List[type]:
|
2322
|
+
"""
|
2323
|
+
Finds all classes in the specified directory which have the 'consumer_udtf' decorator applied
|
2324
|
+
"""
|
2307
2325
|
# Get the directory's absolute path
|
2308
2326
|
current_dir = os.path.abspath(path)
|
2309
2327
|
|
@@ -2328,6 +2346,9 @@ def consumer_udf(
|
|
2328
2346
|
description: str,
|
2329
2347
|
params: List[SnowflakeFunctionParameter],
|
2330
2348
|
result_data_type: str):
|
2349
|
+
"""
|
2350
|
+
A decorator for a function which should be automatically exposed to the consumer as a UDF
|
2351
|
+
"""
|
2331
2352
|
def decorator(func):
|
2332
2353
|
sig = signature(func)
|
2333
2354
|
function_params = sig.parameters
|
@@ -2373,7 +2394,10 @@ def consumer_udf(
|
|
2373
2394
|
|
2374
2395
|
return decorator
|
2375
2396
|
|
2376
|
-
def find_consumer_udf_functions(path:str = '.'):
|
2397
|
+
def find_consumer_udf_functions(path:str = '.') -> List[function]:
|
2398
|
+
"""
|
2399
|
+
Finds all functions in the specified directory which have the 'consumer_udf' decorator applied
|
2400
|
+
"""
|
2377
2401
|
# Get the current directory's absolute path
|
2378
2402
|
current_dir = os.path.abspath(path)
|
2379
2403
|
|
{omnata_plugin_runtime-0.5.7a139.dist-info → omnata_plugin_runtime-0.5.7a141.dist-info}/RECORD
RENAMED
@@ -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=
|
6
|
+
omnata_plugin_runtime/omnata_plugin.py,sha256=TRD_t9QBXSGNHqn3u2ZjRhnxz2_-VBHDZUCRO0BvcQo,120165
|
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.
|
10
|
-
omnata_plugin_runtime-0.5.
|
11
|
-
omnata_plugin_runtime-0.5.
|
12
|
-
omnata_plugin_runtime-0.5.
|
9
|
+
omnata_plugin_runtime-0.5.7a141.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
|
10
|
+
omnata_plugin_runtime-0.5.7a141.dist-info/METADATA,sha256=GxlnEUYJq_OY85r6o6WB0tQUGHg1MktSjdIPpBpRg9k,1985
|
11
|
+
omnata_plugin_runtime-0.5.7a141.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
12
|
+
omnata_plugin_runtime-0.5.7a141.dist-info/RECORD,,
|
{omnata_plugin_runtime-0.5.7a139.dist-info → omnata_plugin_runtime-0.5.7a141.dist-info}/LICENSE
RENAMED
File without changes
|
{omnata_plugin_runtime-0.5.7a139.dist-info → omnata_plugin_runtime-0.5.7a141.dist-info}/WHEEL
RENAMED
File without changes
|