omnata-plugin-runtime 0.5.7a134__tar.gz → 0.5.7a136__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.5.7a134
3
+ Version: 0.5.7a136
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
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "omnata-plugin-runtime"
3
- version = "0.5.7-a134"
3
+ version = "0.5.7-a136"
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"
@@ -2232,16 +2232,16 @@ def get_nested_value(nested_dict:Dict, keys:List[str]):
2232
2232
 
2233
2233
  @dataclass
2234
2234
  class SnowflakeFunctionParameter:
2235
- arg_name: str
2235
+ name: str
2236
2236
  description: str
2237
- arg_data_type: str
2237
+ data_type: str
2238
2238
  has_default_value: bool = False
2239
2239
  default_value_clause: Optional[str] = None
2240
2240
 
2241
2241
  @dataclass
2242
2242
  class SnowflakeUDTFResultColumn:
2243
- column_name: str
2244
- column_data_type: str
2243
+ name: str
2244
+ data_type: str
2245
2245
  description: str
2246
2246
 
2247
2247
  def consumer_udtf(
@@ -2254,7 +2254,8 @@ def consumer_udtf(
2254
2254
  original_process = getattr(cls, 'process')
2255
2255
  sig = signature(original_process)
2256
2256
  params = sig.parameters
2257
-
2257
+ if len(params) < 2:
2258
+ raise ValueError("The function must have the self parameter, plus at least the mandatory 'connection_parameters' parameter.")
2258
2259
  # Ensure the first argument is mandatory and positional
2259
2260
  if list(params.keys())[0] != 'self':
2260
2261
  raise ValueError("The first argument should be 'self' for class methods.")
@@ -2262,8 +2263,8 @@ def consumer_udtf(
2262
2263
  if list(params.keys())[1] != 'connection_parameters':
2263
2264
  raise ValueError("The second argument should be 'connection_parameters'.")
2264
2265
 
2265
- if params[list(params.keys())[1]].annotation != Dict:
2266
- raise ValueError("The second argument must be a dict.")
2266
+ if params[list(params.keys())[1]].annotation != ConnectionConfigurationParameters:
2267
+ raise ValueError("The second argument must be a ConnectionConfigurationParameters.")
2267
2268
 
2268
2269
  @wraps(original_process)
2269
2270
  def wrapped_process(self, connection_parameters, *args, **kwargs):
@@ -2321,12 +2322,13 @@ def consumer_udf(
2321
2322
  def decorator(func):
2322
2323
  sig = signature(func)
2323
2324
  params = sig.parameters
2324
-
2325
+ if len(params) == 0:
2326
+ raise ValueError("The function must have at least one parameter.")
2325
2327
  # Ensure the first argument is mandatory and positional
2326
2328
  if list(params.keys())[0] != 'connection_parameters':
2327
2329
  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.")
2330
+ if params[list(params.keys())[0]].annotation != ConnectionConfigurationParameters:
2331
+ raise ValueError("The first argument must be a ConnectionConfigurationParameters.")
2330
2332
 
2331
2333
  @wraps(func)
2332
2334
  def wrapper(self, connection_parameters, *args, **kwargs):