Skip to content

Commit

Permalink
DIV is Operator
Browse files Browse the repository at this point in the history
  • Loading branch information
chezou authored and andialbrecht committed Aug 8, 2022
1 parent 049634a commit 3668799
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions sqlparse/keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ def is_keyword(value):
'DISABLE': tokens.Keyword,
'DISCONNECT': tokens.Keyword,
'DISPATCH': tokens.Keyword,
'DIV': tokens.Operator,
'DO': tokens.Keyword,
'DOMAIN': tokens.Keyword,
'DYNAMIC': tokens.Keyword,
Expand Down
6 changes: 6 additions & 0 deletions tests/test_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ def test_parse_nested_function():
assert type(t[0]) is sql.Function


def test_parse_div_operator():
p = sqlparse.parse('col1 DIV 5 AS div_col1')[0].tokens
assert p[0].tokens[0].tokens[2].ttype is T.Operator
assert p[0].get_alias() == 'div_col1'


def test_quoted_identifier():
t = sqlparse.parse('select x.y as "z" from foo')[0].tokens
assert isinstance(t[2], sql.Identifier)
Expand Down

0 comments on commit 3668799

Please sign in to comment.