summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmjith Ramanujam <amjith.r@gmail.com>2019-05-06 11:11:57 -0700
committerGitHub <noreply@github.com>2019-05-06 11:11:57 -0700
commit580639904c07c4b29376a144d15fa00f4cd39b9e (patch)
treee86b31ce92f8a09d699e483f992ce16fbb863989
parent9f2d61bc234cff3d33be9c526d8cc38c9e475063 (diff)
parentfe1b202c5589acdfb904910fc7963c2138b591f6 (diff)
Merge pull request #1052 from dbcli/pr1047
Upgrade to sqlparse 0.3.0
-rw-r--r--AUTHORS1
-rw-r--r--changelog.rst2
-rw-r--r--pgcli/packages/sqlcompletion.py4
-rw-r--r--setup.py2
-rw-r--r--tests/test_sqlcompletion.py2
5 files changed, 7 insertions, 4 deletions
diff --git a/AUTHORS b/AUTHORS
index 63eb2c04..87488d11 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -94,6 +94,7 @@ Contributors:
* Nathan Verzemnieks
* raylu
* Zhaolong Zhu
+ * Zane C. Bowers-Hadley
Creator:
--------
diff --git a/changelog.rst b/changelog.rst
index cb08ae3a..d249aaa0 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -8,6 +8,7 @@ Bug fixes:
* Fix for "no attribute KeyringLocked" (#1040). (Thanks: `Irina Truong`_)
* Pgcli no longer works with password containing spaces (#1043). (Thanks: `Irina Truong`_)
* Load keyring only when keyring is enabled in the config file (#1041). (Thanks: `Zhaolong Zhu`_)
+* No longer depend on sqlparse as being less than 0.3.0 with the release of sqlparse 0.3.0. (Thanks: `VVelox`_)
* Fix the broken support for pgservice . (Thanks: `Xavier Francisco`_)
Internal:
@@ -971,3 +972,4 @@ Improvements:
.. _`raylu`: https://github.com/raylu
.. _`Zhaolong Zhu`: https://github.com/zzl0
.. _`Xavier Francisco`: https://github.com/Qu4tro
+.. _`VVelox`: https://github.com/VVelox
diff --git a/pgcli/packages/sqlcompletion.py b/pgcli/packages/sqlcompletion.py
index d128fc5a..8ba282e8 100644
--- a/pgcli/packages/sqlcompletion.py
+++ b/pgcli/packages/sqlcompletion.py
@@ -154,7 +154,7 @@ def suggest_type(full_text, text_before_cursor):
# Be careful here because trivial whitespace is parsed as a
# statement, but the statement won't have a first token
tok1 = stmt.parsed.token_first()
- if tok1 and tok1.value == '\\':
+ if tok1 and tok1.value.startswith('\\'):
text = stmt.text_before_cursor + stmt.word_before_cursor
return suggest_special(text)
@@ -398,7 +398,7 @@ def suggest_based_on_last_token(token, stmt):
elif token_v == 'set':
return (Column(table_refs=stmt.get_tables(),
local_tables=stmt.local_tables),)
- elif token_v in ('select', 'where', 'having', 'by', 'distinct'):
+ elif token_v in ('select', 'where', 'having', 'order by', 'distinct'):
# Check for a table alias or schema qualification
parent = (stmt.identifier and stmt.identifier.get_parent_name()) or []
tables = stmt.get_tables()
diff --git a/setup.py b/setup.py
index 6c25b7a4..775c46ef 100644
--- a/setup.py
+++ b/setup.py
@@ -17,7 +17,7 @@ install_requirements = [
'Pygments >= 2.0', # Pygments has to be Capitalcased. WTF?
'prompt_toolkit>=2.0.6,<2.1.0',
'psycopg2 >= 2.7.4,<2.8',
- 'sqlparse >=0.2.2,<0.3.0',
+ 'sqlparse >=0.3.0,<0.4',
'configobj >= 5.0.6',
'humanize >= 0.5.1',
'cli_helpers[styles] >= 1.2.0',
diff --git a/tests/test_sqlcompletion.py b/tests/test_sqlcompletion.py
index 85fc3789..7e6a8225 100644
--- a/tests/test_sqlcompletion.py
+++ b/tests/test_sqlcompletion.py
@@ -236,7 +236,7 @@ def test_distinct_suggests_cols(text):
(
'SELECT * FROM tbl x JOIN tbl1 y ORDER BY ',
'SELECT * FROM tbl x JOIN tbl1 y ORDER BY ',
- 'BY',
+ 'ORDER BY',
)
])
def test_distinct_and_order_by_suggestions_with_aliases(text, text_before,