omnata-plugin-runtime 0.9.4a217__tar.gz → 0.9.5__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.3
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.9.4a217
3
+ Version: 0.9.5
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.9.4-a217"
3
+ version = "0.9.5"
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"
@@ -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:
@@ -594,7 +602,7 @@ def normalized_view_part(
594
602
  column_name_expression=column_name_expression
595
603
  )
596
604
  if json_schema.joins:
597
- joins = json_schema
605
+ joins = json_schema.joins
598
606
  comment = json_schema.description
599
607
 
600
608
  return SnowflakeViewPart(