Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to sqlparse 0.3.0 #1052

Merged
merged 6 commits into from
May 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ Contributors:
* Nathan Verzemnieks
* raylu
* Zhaolong Zhu
* Zane C. Bowers-Hadley

Creator:
--------
Expand Down
2 changes: 2 additions & 0 deletions changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions pgcli/packages/sqlcompletion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion tests/test_sqlcompletion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down