omnata-plugin-runtime 0.9.4a218__py3-none-any.whl → 0.9.5a219__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -166,16 +166,18 @@ class SnowflakeViewColumn(BaseModel):
166
166
  def definition(self) -> str:
167
167
  return f'{self.expression} as "{self.name}"'
168
168
 
169
- def name_with_comment(self) -> str:
169
+ def name_with_comment(self,binding_list:Optional[List[Any]] = None) -> str:
170
170
  """
171
171
  Returns the column name (quoted), along with any comment.
172
172
  The resulting text can be used in a CREATE VIEW statement.
173
- """
174
- return (
175
- f'"{self.name}"'
176
- if self.comment is None
177
- else f'"{self.name}" COMMENT $${self.comment}$$'
178
- )
173
+ If binding_list is provided, the comment will be added to the list, and a placeholder '?' will be used in the SQL.
174
+ """
175
+ if self.comment is None:
176
+ return f'"{self.name}"'
177
+ if binding_list is not None:
178
+ binding_list.append(self.comment)
179
+ return f'"{self.name}" COMMENT ?'
180
+ return f'"{self.name}" COMMENT $${self.comment}$$'
179
181
 
180
182
  @classmethod
181
183
  def from_json_schema_property(cls,
@@ -357,11 +359,17 @@ class SnowflakeViewPart(BaseModel):
357
359
  """
358
360
  return f"COMMENT = $${self.comment}$$ " if self.comment is not None else ""
359
361
 
360
- def column_names_with_comments(self) -> List[str]:
362
+ def column_names_with_comments(self,binding_list:Optional[List[Any]] = None) -> List[str]:
363
+ """
364
+ Returns a list of column names with comments, suitable for use in a CREATE VIEW statement.
365
+ This includes direct columns first, followed by join columns.
366
+ If binding_list is provided, the comments will be added to the list, and a placeholder '?' will be used in the SQL.
367
+ Otherwise, the comments will be included in the SQL inside of a '$$' delimiter.
368
+ """
361
369
  # the outer view definition has all of the column names and comments, but with the direct columns
362
370
  # first and the join columns last, same as they are ordered in the inner query
363
371
  return [
364
- c.name_with_comment() for c in (self.direct_columns() + self.join_columns())
372
+ c.name_with_comment(binding_list) for c in (self.direct_columns() + self.join_columns())
365
373
  ]
366
374
 
367
375
  def cte_text(self) -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.9.4a218
3
+ Version: 0.9.5a219
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
@@ -2,12 +2,12 @@ omnata_plugin_runtime/__init__.py,sha256=MS9d1whnfT_B3-ThqZ7l63QeC_8OEKTuaYV5wTw
2
2
  omnata_plugin_runtime/api.py,sha256=baGraSMiD4Yvi3ZWrEv_TKh8Ktd1U8riBdOpe9j0Puw,8202
3
3
  omnata_plugin_runtime/configuration.py,sha256=H1snDDtS4DF2AILynob878ZKcronnZl5Qig6dE9KDoc,41189
4
4
  omnata_plugin_runtime/forms.py,sha256=9YHJ_T17lT-rwyDaUg_0yj_YMPda4DRCw_wrvf8hE0E,19964
5
- omnata_plugin_runtime/json_schema.py,sha256=qa0TgikiludW5fMvT4GRIF8__HnIzNIOAF-KvwYfqmo,26013
5
+ omnata_plugin_runtime/json_schema.py,sha256=2NC8ykSuFxshuqUX5c7VjzROec92vwDi9doE1Mbxbhw,26737
6
6
  omnata_plugin_runtime/logging.py,sha256=WBuZt8lF9E5oFWM4KYQbE8dDJ_HctJ1pN3BHwU6rcd0,4461
7
7
  omnata_plugin_runtime/omnata_plugin.py,sha256=IDj8EaWZuEKaTPrWm3wzHvdmW4l2WibCZEj9AnyTHLU,131622
8
8
  omnata_plugin_runtime/plugin_entrypoints.py,sha256=iqGl8_nEEnPGKg3Aem4YLSQ6d5xS3ju5gq8MJbx6sCA,31968
9
9
  omnata_plugin_runtime/rate_limiting.py,sha256=qpr5esU4Ks8hMzuMpSR3gLFdor2ZUXYWCjmsQH_K6lQ,25882
10
- omnata_plugin_runtime-0.9.4a218.dist-info/LICENSE,sha256=rGaMQG3R3F5-JGDp_-rlMKpDIkg5n0SI4kctTk8eZSI,56
11
- omnata_plugin_runtime-0.9.4a218.dist-info/METADATA,sha256=RBjJDbxE3YeMSMBvxUoolCvXnPvvkiIz8rehPX8c_aM,2158
12
- omnata_plugin_runtime-0.9.4a218.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
13
- omnata_plugin_runtime-0.9.4a218.dist-info/RECORD,,
10
+ omnata_plugin_runtime-0.9.5a219.dist-info/LICENSE,sha256=rGaMQG3R3F5-JGDp_-rlMKpDIkg5n0SI4kctTk8eZSI,56
11
+ omnata_plugin_runtime-0.9.5a219.dist-info/METADATA,sha256=-Urf7dTCsgAquRyQ7Nu3U_9wto8AlRZx9dWvaZf1vEI,2158
12
+ omnata_plugin_runtime-0.9.5a219.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
13
+ omnata_plugin_runtime-0.9.5a219.dist-info/RECORD,,