dbcli / mycli

A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting.
http://mycli.net
Other
11.39k stars 657 forks source link

Broken AutoComplete via Debian/Ubuntu Package #551

Open maxsxu opened 6 years ago

maxsxu commented 6 years ago

I got the below error when I try to auto-complete the SQL command:

Version: 1.5.2
Chat: https://gitter.im/dbcli/mycli
Mail: https://groups.google.com/forum/#!forum/mycli-users
Home: http://mycli.net
Thanks to the contributor - Anonymous
mysql root@localhost:(none)> SELECT Exception in thread Thread-6:
Traceback (most recent call last):         
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()                             
  File "/usr/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.5/dist-packages/prompt_toolkit/interface.py", line 865, in run
    completions = list(buffer.completer.get_completions(document, complete_event))
  File "/usr/share/mycli/mycli/sqlcompleter.py", line 256, in get_completions                                         
    suggestions = suggest_type(document.text, document.text_before_cursor)
  File "/usr/share/mycli/mycli/packages/completion_engine.py", line 85, in suggest_type
    full_text, identifier)
  File "/usr/share/mycli/mycli/packages/completion_engine.py", line 134, in suggest_based_on_last_token
    token_v = token.value.lower()
AttributeError: 'tuple' object has no attribute 'value'

I install mycli via sudo apt install mycli

Below is my environment:

But imycli works fine when I install mycli via sudo pip3 install mycli.

meeuw commented 6 years ago

IIRC this is caused by an invalid version of sqlparse. We should update mycli in Ubuntu but in the meantime I suggest you install mycli using pip. See: http://www.mycli.net/install

tsroten commented 6 years ago

@meeuw Yeah, I don't know if we have anyone actively packing mycli for Ubuntu. @amjith, who used to help us with that?

amjith commented 6 years ago

I don't think anyone is doing it. Last time it was packaged by @lhw. But I don't think he's doing it anymore.

meeuw commented 6 years ago

Hmm I've installed mycli in Ubuntu Xenial (from docker, ubuntu:xenial) and ran:

apt-get update
apt-get install mycli

And that seems to work. Could you check the version of python3-sqlparse? I'm using 0.1.18-1...

maxsxu commented 6 years ago

I use sqlparse 0.2.4. So it's caused by the version of sqlparse. @meeuw

lhw commented 6 years ago

Debian package dependencies for sqlparse are >=0.2.2, <= 0.3.0. The only version in debian from stable to unstable is 0.2.2.

Also new versions of the packages are in my gits on salsa.debian.org: https://salsa.debian.org/lhw-guest/mycli https://salsa.debian.org/lhw-guest/pgcli

But both need the additional library you have added recently: https://salsa.debian.org/lhw-guest/cli_helpers

When that one is in debian I can upload the other clis again.

lhw commented 6 years ago

I instead vendorized the cli_helpers. pgcli and mycli are updated in unstable

amjith commented 6 years ago

Thank you!

🕺