Skip to content

Commit df69903

Browse files
committed
Add change for sqlparse 0.3.0
1 parent 448da4c commit df69903

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

mssqlcli/packages/sqlcompletion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def suggest_type(full_text, text_before_cursor):
153153
# Be careful here because trivial whitespace is parsed as a
154154
# statement, but the statement won't have a first token
155155
tok1 = stmt.parsed.token_first()
156-
if tok1 and tok1.value == '\\':
156+
if tok1 and tok1.value.startswith('\\'):
157157
text = stmt.text_before_cursor + stmt.word_before_cursor
158158
return suggest_special(text)
159159

@@ -388,7 +388,7 @@ def suggest_based_on_last_token(token, stmt):
388388
if token_v == 'set':
389389
return (Column(table_refs=stmt.get_tables(),
390390
local_tables=stmt.local_tables),)
391-
if token_v in ('select', 'where', 'having', 'by', 'distinct'):
391+
if token_v in ('select', 'where', 'having', 'order by', 'distinct'):
392392
# Check for a table alias or schema qualification
393393
parent = stmt.identifier.get_parent_name() \
394394
if (stmt.identifier and stmt.identifier.get_parent_name()) else []

tests/test_sqlcompletion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def test_distinct_and_order_by_suggestions_with_aliases():
271271
(
272272
'SELECT * FROM tbl x JOIN tbl1 y ORDER BY ',
273273
'SELECT * FROM tbl x JOIN tbl1 y ORDER BY ',
274-
'BY',
274+
'ORDER BY',
275275
)
276276
]
277277
for arg in test_args:

0 commit comments

Comments
 (0)