Adding upstream version 24.1.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
8b1190270c
commit
dd3422a695
70 changed files with 55134 additions and 50721 deletions
|
@ -473,6 +473,14 @@ class Snowflake(Dialect):
|
|||
"TERSE USERS": _show_parser("USERS"),
|
||||
}
|
||||
|
||||
CONSTRAINT_PARSERS = {
|
||||
**parser.Parser.CONSTRAINT_PARSERS,
|
||||
"WITH": lambda self: self._parse_with_constraint(),
|
||||
"MASKING": lambda self: self._parse_with_constraint(),
|
||||
"PROJECTION": lambda self: self._parse_with_constraint(),
|
||||
"TAG": lambda self: self._parse_with_constraint(),
|
||||
}
|
||||
|
||||
STAGED_FILE_SINGLE_TOKENS = {
|
||||
TokenType.DOT,
|
||||
TokenType.MOD,
|
||||
|
@ -497,6 +505,29 @@ class Snowflake(Dialect):
|
|||
),
|
||||
}
|
||||
|
||||
def _parse_with_constraint(self) -> t.Optional[exp.Expression]:
|
||||
if self._prev.token_type != TokenType.WITH:
|
||||
self._retreat(self._index - 1)
|
||||
|
||||
if self._match_text_seq("MASKING", "POLICY"):
|
||||
return self.expression(
|
||||
exp.MaskingPolicyColumnConstraint,
|
||||
this=self._parse_id_var(),
|
||||
expressions=self._match(TokenType.USING)
|
||||
and self._parse_wrapped_csv(self._parse_id_var),
|
||||
)
|
||||
if self._match_text_seq("PROJECTION", "POLICY"):
|
||||
return self.expression(
|
||||
exp.ProjectionPolicyColumnConstraint, this=self._parse_id_var()
|
||||
)
|
||||
if self._match(TokenType.TAG):
|
||||
return self.expression(
|
||||
exp.TagColumnConstraint,
|
||||
expressions=self._parse_wrapped_csv(self._parse_property),
|
||||
)
|
||||
|
||||
return None
|
||||
|
||||
def _parse_create(self) -> exp.Create | exp.Command:
|
||||
expression = super()._parse_create()
|
||||
if isinstance(expression, exp.Create) and expression.kind in self.NON_TABLE_CREATABLES:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue