Skip to content

Commit

Permalink
sqlparse now understands these queries
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Cederstrand committed Sep 26, 2022
1 parent f6c8f23 commit 6a8206c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/unit_tests/sql_parse_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1013,15 +1013,15 @@ def test_unknown_select() -> None:
Test that `is_select` works when sqlparse fails to identify the type.
"""
sql = "WITH foo AS(SELECT 1) SELECT 1"
assert sqlparse.parse(sql)[0].get_type() == "UNKNOWN"
assert sqlparse.parse(sql)[0].get_type() == "SELECT"
assert ParsedQuery(sql).is_select()

sql = "WITH foo AS(SELECT 1) INSERT INTO my_table (a) VALUES (1)"
assert sqlparse.parse(sql)[0].get_type() == "UNKNOWN"
assert sqlparse.parse(sql)[0].get_type() == "INSERT"
assert not ParsedQuery(sql).is_select()

sql = "WITH foo AS(SELECT 1) DELETE FROM my_table"
assert sqlparse.parse(sql)[0].get_type() == "UNKNOWN"
assert sqlparse.parse(sql)[0].get_type() == "DELETE"
assert not ParsedQuery(sql).is_select()


Expand Down

0 comments on commit 6a8206c

Please sign in to comment.