summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Marsh <kevinmarsh@users.noreply.github.com>2020-12-01 16:03:38 -0800
committerGitHub <noreply@github.com>2020-12-01 16:03:38 -0800
commit34d6e080ff072a82a91a0dd8f60b92900051eb56 (patch)
tree999062eb7311568a0d2ce28c245a477f68b21a91
parentbbf5b2041576ebfcae120acacd27b99a7f0a9b72 (diff)
dependencies: add support for sqlparse 0.4.x (#1224)
-rw-r--r--AUTHORS1
-rw-r--r--changelog.rst1
-rw-r--r--pgcli/packages/parseutils/ctes.py2
-rw-r--r--setup.py2
-rw-r--r--tests/test_sqlcompletion.py2
5 files changed, 5 insertions, 3 deletions
diff --git a/AUTHORS b/AUTHORS
index 21263c89..baaf758c 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -113,6 +113,7 @@ Contributors:
* Seungyong Kwak (GUIEEN)
* Tom Caruso (tomplex)
* Jan Brun Rasmussen (janbrunrasmussen)
+ * Kevin Marsh (kevinmarsh)
Creator:
--------
diff --git a/changelog.rst b/changelog.rst
index b303970f..dc197804 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -9,6 +9,7 @@ Features:
* Update python version in Dockerfile
* Support setting color for null, string, number, keyword value
* Support Prompt Toolkit 2
+* Support sqlparse 0.4.x
* Update functions, datatypes literals for auto-suggestion field
* Add suggestion for schema in function auto-complete
diff --git a/pgcli/packages/parseutils/ctes.py b/pgcli/packages/parseutils/ctes.py
index 171d2002..e1f90885 100644
--- a/pgcli/packages/parseutils/ctes.py
+++ b/pgcli/packages/parseutils/ctes.py
@@ -16,7 +16,7 @@ TableExpression = namedtuple("TableExpression", "name columns start stop")
def isolate_query_ctes(full_text, text_before_cursor):
"""Simplify a query by converting CTEs into table metadata objects"""
- if not full_text:
+ if not full_text or not full_text.strip():
return full_text, text_before_cursor, tuple()
ctes, remainder = extract_ctes(full_text)
diff --git a/setup.py b/setup.py
index 6495a51d..fc210323 100644
--- a/setup.py
+++ b/setup.py
@@ -13,7 +13,7 @@ install_requirements = [
# see: https://github.com/dbcli/pgcli/pull/1197
"prompt_toolkit>=2.0.6,<4.0.0",
"psycopg2 >= 2.8",
- "sqlparse >=0.3.0,<0.4",
+ "sqlparse >=0.3.0,<0.5",
"configobj >= 5.0.6",
"pendulum>=2.1.0",
"cli_helpers[styles] >= 2.0.0",
diff --git a/tests/test_sqlcompletion.py b/tests/test_sqlcompletion.py
index c5ef7b7d..3cbad0ad 100644
--- a/tests/test_sqlcompletion.py
+++ b/tests/test_sqlcompletion.py
@@ -816,7 +816,7 @@ def test_create_db_with_template():
assert set(suggestions) == set((Database(),))
-@pytest.mark.parametrize("initial_text", ("", " ", "\t \t"))
+@pytest.mark.parametrize("initial_text", ("", " ", "\t \t", "\n"))
def test_specials_included_for_initial_completion(initial_text):
suggestions = suggest_type(initial_text, initial_text)