Adding upstream version 16.7.3.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
2af48256b8
commit
7297023f4e
75 changed files with 33866 additions and 31988 deletions
|
@ -258,14 +258,29 @@ class Snowflake(Dialect):
|
|||
|
||||
ALTER_PARSERS = {
|
||||
**parser.Parser.ALTER_PARSERS,
|
||||
"UNSET": lambda self: self._parse_alter_table_set_tag(unset=True),
|
||||
"SET": lambda self: self._parse_alter_table_set_tag(),
|
||||
"SET": lambda self: self._parse_set(tag=self._match_text_seq("TAG")),
|
||||
"UNSET": lambda self: self.expression(
|
||||
exp.Set,
|
||||
tag=self._match_text_seq("TAG"),
|
||||
expressions=self._parse_csv(self._parse_id_var),
|
||||
unset=True,
|
||||
),
|
||||
}
|
||||
|
||||
def _parse_alter_table_set_tag(self, unset: bool = False) -> exp.Expression:
|
||||
self._match_text_seq("TAG")
|
||||
parser = t.cast(t.Callable, self._parse_id_var if unset else self._parse_conjunction)
|
||||
return self.expression(exp.SetTag, expressions=self._parse_csv(parser), unset=unset)
|
||||
def _parse_id_var(
|
||||
self,
|
||||
any_token: bool = True,
|
||||
tokens: t.Optional[t.Collection[TokenType]] = None,
|
||||
) -> t.Optional[exp.Expression]:
|
||||
if self._match_text_seq("IDENTIFIER", "("):
|
||||
identifier = (
|
||||
super()._parse_id_var(any_token=any_token, tokens=tokens)
|
||||
or self._parse_string()
|
||||
)
|
||||
self._match_r_paren()
|
||||
return self.expression(exp.Anonymous, this="IDENTIFIER", expressions=[identifier])
|
||||
|
||||
return super()._parse_id_var(any_token=any_token, tokens=tokens)
|
||||
|
||||
class Tokenizer(tokens.Tokenizer):
|
||||
QUOTES = ["'", "$$"]
|
||||
|
@ -380,10 +395,6 @@ class Snowflake(Dialect):
|
|||
self.unsupported("INTERSECT with All is not supported in Snowflake")
|
||||
return super().intersect_op(expression)
|
||||
|
||||
def settag_sql(self, expression: exp.SetTag) -> str:
|
||||
action = "UNSET" if expression.args.get("unset") else "SET"
|
||||
return f"{action} TAG {self.expressions(expression)}"
|
||||
|
||||
def describe_sql(self, expression: exp.Describe) -> str:
|
||||
# Default to table if kind is unknown
|
||||
kind_value = expression.args.get("kind") or "TABLE"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue