mirror of https://github.com/dbcli/pgcli
Upgrade to sqlparse 0.3.0.
This commit is contained in:
parent
1421da3c33
commit
1908142adb
|
@ -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()
|
||||
|
|
2
setup.py
2
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',
|
||||
'sqlparse >=0.3.0,<0.4',
|
||||
'configobj >= 5.0.6',
|
||||
'humanize >= 0.5.1',
|
||||
'cli_helpers[styles] >= 1.2.0',
|
||||
|
|
|
@ -317,5 +317,5 @@ def test_application_name_db_uri(tmpdir):
|
|||
mock_pgexecute.return_value = None
|
||||
cli = PGCli(pgclirc_file=str(tmpdir.join("rcfile")))
|
||||
cli.connect_uri('postgres://bar@baz.com/?application_name=cow')
|
||||
mock_pgexecute.assert_called_with('bar', 'bar', '', 'baz.com', '', '',
|
||||
mock_pgexecute.assert_called_with('bar', 'bar', None, 'baz.com', '', '',
|
||||
application_name='cow')
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue