Skip to content

Commit

Permalink
added EXCLUDING as well
Browse files Browse the repository at this point in the history
  • Loading branch information
yuchaofan13 committed Nov 24, 2022
1 parent 1f9abe7 commit fd2ea96
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions sqlglot/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,10 @@ class IncludingProperty(Property):
arg_types = {"this": True}


class ExcludingProperty(Property):
arg_types = {"this": True}


class LocationProperty(Property):
arg_types = {"this": True}

Expand Down Expand Up @@ -1134,6 +1138,7 @@ class Properties(Expression):
"EXECUTE AS": ExecuteAsProperty,
"FORMAT": FileFormatProperty,
"INCLUDING": IncludingProperty,
"EXCLUDING": ExcludingProperty,
"LANGUAGE": LanguageProperty,
"LOCATION": LocationProperty,
"PARTITIONED_BY": PartitionedByProperty,
Expand Down
3 changes: 2 additions & 1 deletion sqlglot/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ class Parser(metaclass=_Parser):
TokenType.DISTSTYLE: lambda self: self._parse_property_assignment(exp.DistStyleProperty),
TokenType.SORTKEY: lambda self: self._parse_sortkey(),
TokenType.INCLUDING: lambda self: self._parse_property_assignment(exp.IncludingProperty),
TokenType.EXCLUDING: lambda self: self._parse_property_assignment(exp.ExcludingProperty),
TokenType.RETURNS: lambda self: self._parse_returns(),
TokenType.COLLATE: lambda self: self._parse_property_assignment(exp.CollateProperty),
TokenType.COMMENT: lambda self: self._parse_property_assignment(exp.SchemaCommentProperty),
Expand Down Expand Up @@ -838,7 +839,7 @@ def _parse_create(self):
exp.Like, this=this, expression=self._parse_table(schema=True)
)
elif self._match_pair(TokenType.L_PAREN, TokenType.LIKE):
# create table a (like b including constraints including statistics)
# create table a (like b including constraints excluding statistics)
expression = self.expression(
exp.Like, this=this, expression=self._parse_table(schema=True)
)
Expand Down
2 changes: 2 additions & 0 deletions sqlglot/tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ class TokenType(AutoName):
ENGINE = auto()
ESCAPE = auto()
EXCEPT = auto()
EXCLUDING = auto()
EXECUTE = auto()
EXISTS = auto()
FALSE = auto()
Expand Down Expand Up @@ -481,6 +482,7 @@ class Tokenizer(metaclass=_Tokenizer):
"ENGINE": TokenType.ENGINE,
"ESCAPE": TokenType.ESCAPE,
"EXCEPT": TokenType.EXCEPT,
"EXCLUDING": TokenType.EXCLUDING,
"EXECUTE": TokenType.EXECUTE,
"EXISTS": TokenType.EXISTS,
"FALSE": TokenType.FALSE,
Expand Down

0 comments on commit fd2ea96

Please sign in to comment.