omnata-plugin-runtime 0.5.9a161__py3-none-any.whl → 0.5.10__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -112,6 +112,90 @@ class PluginManifest(SubscriptableBaseModel):
112
112
  supported_outbound_strategies: List[OutboundSyncStrategy]
113
113
 
114
114
 
115
+ class SnowflakeFunctionParameter(BaseModel):
116
+ """
117
+ Represents a parameter for a Snowflake UDF or UDTF
118
+ """
119
+ name: str
120
+ description: str
121
+ data_type: str
122
+ default_value_clause: Optional[str] = None
123
+
124
+ def __str__(self):
125
+ if self.default_value_clause:
126
+ return f"{self.name} {self.data_type} default {self.default_value_clause}"
127
+ return f"{self.name} {self.data_type}"
128
+
129
+ class SnowflakeUDTFResultColumn(BaseModel):
130
+ """
131
+ Represents a result column for a Snowflake UDTF
132
+ """
133
+ name: str
134
+ data_type: str
135
+ def __str__(self):
136
+ return f"{self.name} {self.data_type}"
137
+
138
+ class UDTFDefinition(BaseModel):
139
+ """
140
+ The information needed by the plugin uploader to put a Python UDTF definition into the setup script.
141
+ Do not use this class directly in plugins, instead use the omnata_udtf decorator.
142
+ """
143
+ name: str = Field(..., title="The name of the UDTF")
144
+ language: Literal['python','java'] = Field(..., title="The language of the UDF")
145
+ runtime_version: str = Field(..., title="The runtime version of the UDF (language dependent)")
146
+ description: str = Field(..., title="A description of the UDTF")
147
+ params: List[SnowflakeFunctionParameter] = Field(..., title="The parameters of the UDTF")
148
+ result_columns: List[SnowflakeUDTFResultColumn] = Field(..., title="The result columns of the UDTF")
149
+ handler: str = Field(..., title="The handler class/function for the UDTF")
150
+ expose_to_consumer: bool = Field(..., title="Whether the UDTF should be exposed to consumers")
151
+ imports: Optional[List[str]] = Field(None, title="A list of imports required by the UDF")
152
+ packages: Optional[List[str]] = Field(None, title="A list of packages required by the UDTF")
153
+
154
+ def __str__(self):
155
+ param_str = ', '.join([str(param) for param in self.params])
156
+ table_result_columns = ', '.join([f"{col.name} {col.data_type}" for col in self.result_columns])
157
+ packages_str = ', '.join([f"'{p}'" for p in self.packages])
158
+ imports_str = ', '.join([f"'{i}'" for i in self.imports])
159
+ return f"""CREATE OR REPLACE FUNCTION UDFS.{self.name}({param_str})
160
+ RETURNS TABLE({table_result_columns})
161
+ LANGUAGE {self.language.upper()}
162
+ RUNTIME_VERSION={self.runtime_version}
163
+ COMMENT = $${self.description}$$
164
+ PACKAGES = ({packages_str})
165
+ IMPORTS = ({imports_str})
166
+ HANDLER='{self.handler}';
167
+ """
168
+
169
+ class UDFDefinition(BaseModel):
170
+ """
171
+ The information needed by the plugin uploader to put a Python UDF definition into the setup script.
172
+ Do not use this class directly in plugins, instead use the omnata_udf decorator.
173
+ """
174
+ name: str = Field(..., title="The name of the UDF")
175
+ language: Literal['python','java'] = Field(..., title="The language of the UDF")
176
+ runtime_version: str = Field(..., title="The runtime version of the UDF (language dependent)")
177
+ description: str = Field(..., title="A description of the UDF")
178
+ params: List[SnowflakeFunctionParameter] = Field(..., title="The parameters of the UDF")
179
+ result_data_type: str = Field(..., title="The data type returned by the UDF")
180
+ handler: str = Field(..., title="The handler class/function for the UDF")
181
+ expose_to_consumer: bool = Field(..., title="Whether the UDF should be exposed to consumers")
182
+ imports: Optional[List[str]] = Field(None, title="A list of imports required by the UDF")
183
+ packages: Optional[List[str]] = Field(None, title="A list of packages required by the UDF")
184
+
185
+ def __str__(self):
186
+ param_str = ', '.join([str(param) for param in self.params])
187
+ packages_str = ', '.join([f"'{p}'" for p in self.packages])
188
+ imports_str = ', '.join([f"'{i}'" for i in self.imports])
189
+ return f"""CREATE OR REPLACE FUNCTION UDFS.{self.name}({param_str})
190
+ RETURNS {self.result_data_type}
191
+ LANGUAGE {self.language.upper()}
192
+ RUNTIME_VERSION={self.runtime_version}
193
+ COMMENT = $${self.description}$$
194
+ PACKAGES = ({packages_str})
195
+ IMPORTS = ({imports_str})
196
+ HANDLER='{self.handler}';
197
+ """
198
+
115
199
  class PluginInfo(BaseModel):
116
200
  """
117
201
  Manifest plus other derived information about a plugin which is determined during upload.
@@ -2234,90 +2318,6 @@ def get_nested_value(nested_dict:Dict, keys:List[str]):
2234
2318
  return reduce(lambda d, key: d.get(key) if isinstance(d, dict) else None, keys, nested_dict)
2235
2319
 
2236
2320
 
2237
- class SnowflakeFunctionParameter(BaseModel):
2238
- """
2239
- Represents a parameter for a Snowflake UDF or UDTF
2240
- """
2241
- name: str
2242
- description: str
2243
- data_type: str
2244
- default_value_clause: Optional[str] = None
2245
-
2246
- def __str__(self):
2247
- if self.default_value_clause:
2248
- return f"{self.name} {self.data_type} default {self.default_value_clause}"
2249
- return f"{self.name} {self.data_type}"
2250
-
2251
- class SnowflakeUDTFResultColumn(BaseModel):
2252
- """
2253
- Represents a result column for a Snowflake UDTF
2254
- """
2255
- name: str
2256
- data_type: str
2257
- def __str__(self):
2258
- return f"{self.name} {self.data_type}"
2259
-
2260
- class UDTFDefinition(BaseModel):
2261
- """
2262
- The information needed by the plugin uploader to put a Python UDTF definition into the setup script.
2263
- Do not use this class directly in plugins, instead use the omnata_udtf decorator.
2264
- """
2265
- name: str = Field(..., title="The name of the UDTF")
2266
- language: Literal['python','java'] = Field(..., title="The language of the UDF")
2267
- runtime_version: str = Field(..., title="The runtime version of the UDF (language dependent)")
2268
- description: str = Field(..., title="A description of the UDTF")
2269
- params: List[SnowflakeFunctionParameter] = Field(..., title="The parameters of the UDTF")
2270
- result_columns: List[SnowflakeUDTFResultColumn] = Field(..., title="The result columns of the UDTF")
2271
- handler: str = Field(..., title="The handler class/function for the UDTF")
2272
- expose_to_consumer: bool = Field(..., title="Whether the UDTF should be exposed to consumers")
2273
- imports: Optional[List[str]] = Field(None, title="A list of imports required by the UDF")
2274
- packages: Optional[List[str]] = Field(None, title="A list of packages required by the UDTF")
2275
-
2276
- def __str__(self):
2277
- param_str = ', '.join([str(param) for param in self.params])
2278
- table_result_columns = ', '.join([f"{col.name} {col.data_type}" for col in self.result_columns])
2279
- packages_str = ', '.join([f"'{p}'" for p in self.packages])
2280
- imports_str = ', '.join([f"'{i}'" for i in self.imports])
2281
- return f"""CREATE OR REPLACE FUNCTION UDFS.{self.name}({param_str})
2282
- RETURNS TABLE({table_result_columns})
2283
- LANGUAGE {self.language.upper()}
2284
- RUNTIME_VERSION={self.runtime_version}
2285
- COMMENT = $${self.description}$$
2286
- PACKAGES = ({packages_str})
2287
- IMPORTS = ({imports_str})
2288
- HANDLER='{self.handler}';
2289
- """
2290
-
2291
- class UDFDefinition(BaseModel):
2292
- """
2293
- The information needed by the plugin uploader to put a Python UDF definition into the setup script.
2294
- Do not use this class directly in plugins, instead use the omnata_udf decorator.
2295
- """
2296
- name: str = Field(..., title="The name of the UDF")
2297
- language: Literal['python','java'] = Field(..., title="The language of the UDF")
2298
- runtime_version: str = Field(..., title="The runtime version of the UDF (language dependent)")
2299
- description: str = Field(..., title="A description of the UDF")
2300
- params: List[SnowflakeFunctionParameter] = Field(..., title="The parameters of the UDF")
2301
- result_data_type: str = Field(..., title="The data type returned by the UDF")
2302
- handler: str = Field(..., title="The handler class/function for the UDF")
2303
- expose_to_consumer: bool = Field(..., title="Whether the UDF should be exposed to consumers")
2304
- imports: Optional[List[str]] = Field(None, title="A list of imports required by the UDF")
2305
- packages: Optional[List[str]] = Field(None, title="A list of packages required by the UDF")
2306
-
2307
- def __str__(self):
2308
- param_str = ', '.join([str(param) for param in self.params])
2309
- packages_str = ', '.join([f"'{p}'" for p in self.packages])
2310
- imports_str = ', '.join([f"'{i}'" for i in self.imports])
2311
- return f"""CREATE OR REPLACE FUNCTION UDFS.{self.name}({param_str})
2312
- RETURNS {self.result_data_type}
2313
- LANGUAGE {self.language.upper()}
2314
- RUNTIME_VERSION={self.runtime_version}
2315
- COMMENT = $${self.description}$$
2316
- PACKAGES = ({packages_str})
2317
- IMPORTS = ({imports_str})
2318
- HANDLER='{self.handler}';
2319
- """
2320
-
2321
2321
  def omnata_udtf(
2322
2322
  name:str,
2323
2323
  description: str,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.5.9a161
3
+ Version: 0.5.10
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=FkJXOxU6n63DTgiGB-rD1vk2nHjr6qoWnb28RxSlE_w,128957
6
+ omnata_plugin_runtime/omnata_plugin.py,sha256=PDPaUHbYuhbWfY3xj0g__EejO9bOGv7xt3weuUDM_bo,128957
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.9a161.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
10
- omnata_plugin_runtime-0.5.9a161.dist-info/METADATA,sha256=lmBdPKUP3HfLI8gv115ZsT5CiNlmTUxU72HGYDstENA,1985
11
- omnata_plugin_runtime-0.5.9a161.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
12
- omnata_plugin_runtime-0.5.9a161.dist-info/RECORD,,
9
+ omnata_plugin_runtime-0.5.10.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
10
+ omnata_plugin_runtime-0.5.10.dist-info/METADATA,sha256=kNuFZBhkStkg8wsq21vu-qPsc5_cYcWn7E1V_vrODjg,1982
11
+ omnata_plugin_runtime-0.5.10.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
12
+ omnata_plugin_runtime-0.5.10.dist-info/RECORD,,