diff --git a/AUTHORS b/AUTHORS index 63eb2c048..87488d111 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 cb08ae3a9..d249aaa0f 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 d128fc5a1..8ba282e83 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 6c25b7a45..775c46ef1 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ '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 85fc37896..7e6a82253 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,