chore(deps): Unpin sqlparse dependency (#21581)

Co-authored-by: Erik Cederstrand <erik@adamatics.com>
Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
This commit is contained in:
Erik Cederstrand
2022-09-26 16:41:04 +02:00
committed by GitHub
parent 73429c6b2a
commit 82bd5a31b8
3 changed files with 5 additions and 18 deletions

View File

@@ -266,13 +266,9 @@ def test_extract_tables_illdefined() -> None:
assert extract_tables("SELECT * FROM catalogname..tbname") == set()
@unittest.skip("Requires sqlparse>=3.1")
def test_extract_tables_show_tables_from() -> None:
"""
Test ``SHOW TABLES FROM``.
This is currently broken in the pinned version of sqlparse, and fixed in
``sqlparse>=3.1``. However, ``sqlparse==3.1`` breaks some sql formatting.
"""
assert extract_tables("SHOW TABLES FROM s1 like '%order%'") == set()
@@ -1017,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()
@@ -1108,15 +1104,6 @@ SELECT * FROM birth_names LIMIT 1
def test_sqlparse_formatting():
"""
Test that ``from_unixtime`` is formatted correctly.
``sqlparse==0.3.1`` has a bug and removes space between ``from`` and
``from_unixtime``, resulting in::
SELECT extract(HOUR
fromfrom_unixtime(hour_ts)
AT TIME ZONE 'America/Los_Angeles')
from table
"""
assert sqlparse.format(
"SELECT extract(HOUR from from_unixtime(hour_ts) "