diff --git a/changelog.md b/changelog.md index f3b3f502..b873f191 100644 --- a/changelog.md +++ b/changelog.md @@ -15,7 +15,6 @@ Bug Fixes: * Fix favorites queries being loaded/stored only from/in default config file and not --myclirc (Thanks: [Matheus Rosa]) * Fix automatic vertical output with native syntax style (Thanks: [Thomas Roten]). * Update `cli_helpers` version, this will remove quotes from batch output like the official client (Thanks: [Dick Marinus]) -* Update `setup.py` to no longer require `sqlparse` to be less than 0.3.0 as that just came out and there are no notable changes. ([VVelox]) * workaround for ConfigObj parsing strings containing "," as lists (Thanks: [Mike Palandra]) Internal: diff --git a/mycli/AUTHORS b/mycli/AUTHORS index ae1fb08a..22ed896e 100644 --- a/mycli/AUTHORS +++ b/mycli/AUTHORS @@ -64,7 +64,6 @@ Contributors: * Yang Zou * Angelo Lupo * Aljosha Papsch - * Zane C. Bowers-Hadley * Mike Palandra Creator: diff --git a/mycli/packages/completion_engine.py b/mycli/packages/completion_engine.py index bea79274..2426f30c 100644 --- a/mycli/packages/completion_engine.py +++ b/mycli/packages/completion_engine.py @@ -84,7 +84,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 = statement.token_first() - if tok1 and (tok1.value == 'source' or tok1.value.startswith('\\')): + if tok1 and tok1.value in ['\\', 'source']: return suggest_special(text_before_cursor) last_token = statement and statement.token_prev(len(statement.tokens))[1] or '' @@ -199,7 +199,7 @@ def suggest_based_on_last_token(token, text_before_cursor, full_text, identifier # We're probably in a function argument list return [{'type': 'column', 'tables': extract_tables(full_text)}] - elif token_v in ('set', 'order by', 'distinct'): + elif token_v in ('set', 'by', 'distinct'): return [{'type': 'column', 'tables': extract_tables(full_text)}] elif token_v == 'as': # Don't suggest anything for an alias diff --git a/setup.py b/setup.py index 3081f19c..1dc1d1a8 100755 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ 'Pygments >= 1.6', 'prompt_toolkit>=2.0.6', 'PyMySQL >= 0.9.2', - 'sqlparse>=0.3.0,<0.4.0', + 'sqlparse>=0.2.2,<0.3.0', 'configobj >= 5.0.5', 'cryptography >= 1.0.0', 'cli_helpers[styles] > 1.1.0', diff --git a/test/test_completion_engine.py b/test/test_completion_engine.py index 98b89e1e..0e814795 100644 --- a/test/test_completion_engine.py +++ b/test/test_completion_engine.py @@ -523,9 +523,3 @@ def test_after_as(expression): def test_source_is_file(expression): suggestions = suggest_type(expression, expression) assert suggestions == [{'type': 'file_name'}] - - -def test_order_by(): - text = 'select * from foo order by ' - suggestions = suggest_type(text, text) - assert suggestions == [{'tables': [(None, 'foo', None)], 'type': 'column'}]