Skip to content

Commit a00bf24

Browse files
committed
* Added missing SET keyword.
* IdentifierList.get_identifiers() now returns not only Identifier instances.
1 parent c8c2352 commit a00bf24

5 files changed

Lines changed: 7 additions & 2 deletions

File tree

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ In Development
55
prefixed with @.
66
* Improved parsing of identifier lists (issue2).
77
* Recursive recognition of AS (issue4) and CASE.
8+
* Improved support for UPDATE statements.
89

910

1011
Release 0.1.0

sqlparse/engine/grouping.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ def group_identifier_list(tlist):
139139
lambda t: t.match(T.Keyword, 'null'),
140140
lambda t: t.ttype == T.Number.Integer,
141141
lambda t: t.ttype == T.String.Single,
142+
lambda t: isinstance(t, Comparsion),
142143
]
143144
tcomma = tlist.token_next_match(idx, T.Punctuation, ',')
144145
start = None

sqlparse/filters.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ def nl(self):
162162

163163
def _split_kwds(self, tlist):
164164
split_words = ('FROM', 'JOIN$', 'AND', 'OR',
165-
'GROUP', 'ORDER', 'UNION', 'VALUES')
165+
'GROUP', 'ORDER', 'UNION', 'VALUES',
166+
'SET')
166167
idx = 0
167168
token = tlist.token_next_match(idx, T.Keyword, split_words,
168169
regex=True)

sqlparse/keywords.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@
565565
'LIKE': Keyword,
566566
'ON': Keyword,
567567
'IN': Keyword,
568+
'SET': Keyword,
568569

569570
'BY': Keyword,
570571
'GROUP': Keyword,

sqlparse/sql.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,8 @@ def get_identifiers(self):
386386
387387
Whitespaces and punctuations are not included in this list.
388388
"""
389-
return [x for x in self.tokens if isinstance(x, Identifier)]
389+
return [x for x in self.tokens
390+
if not x.is_whitespace() and not x.match(T.Punctuation, ',')]
390391

391392

392393
class Parenthesis(TokenList):

0 commit comments

Comments
 (0)