dbcli / mycli

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

Add a user-friendly message for MemoryError #663

Open greg0ire opened 5 years ago

greg0ire commented 5 years ago

I'm trying to import a big dump that will not fit in my RAM, here is what I'm getting:

~/.local/bin/mycli -h localhost -uroot -p mydb < /tmp/dump.sql
Traceback (most recent call last):
  File "/home/gregoire/.local/bin/mycli", line 11, in <module>
    sys.exit(cli())
  File "/home/gregoire/.local/lib/python3.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/gregoire/.local/lib/python3.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/gregoire/.local/lib/python3.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/gregoire/.local/lib/python3.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/gregoire/.local/lib/python3.7/site-packages/mycli/main.py", line 1094, in cli
    stdin_text = stdin.read()
MemoryError
meeuw commented 5 years ago

This won't be an easy fix for mycli. I really recommend using the official mysql client for importing (big) mysqldumps (besides using less memory it's faster).

greg0ire commented 5 years ago

Ok, that's what I ended up doing… any way to maybe catch the memory error and display that advice, maybe? That way you won't have people like me reporting this "bug" again…