sqlcrush icon indicating copy to clipboard operation
sqlcrush copied to clipboard

CRITICAL FAILURE...

Open pavelsr opened this issue 7 years ago • 6 comments

When I run sqlcrush -t sqlite -d skud.db I select needed table ui crashed and I got CRITICAL FAILURE... in terminal.

Also in UI I have:

Could not instantiate type <class 'sqlalchemy.sql.sqltypes.INTEGER'> with reflected arguments [u'2']; using no arguments

Vesion of module is 0.1.15

pi@raspberrypi:~/data $ pip show sqlcrush
Name: sqlcrush
Version: 0.1.5
Summary: console based database editor
Home-page: http://github.com/coffeeandscripts/sqlcrush
Author: coffeeandscripts
Author-email: [email protected]
License: GNU
Location: /usr/local/lib/python2.7/dist-packages
Requires: psycopg2, sqlalchemy, pymysql

pavelsr avatar Nov 27 '17 14:11 pavelsr

I'm getting the same thing. I run: sqlcrush -t postgresql -d common -u docker -pd my_secure_password -h localhost -p 54320 (I'm running a non-standard port).

This is what I get:

 ______   ______    __       ______   ______    __  __   ______   ___   ___
/_____/\ /_____/\  /_/\     /_____/\ /_____/\  /_/\/_/\ /_____/\ /__/\ /__/\
\::::_\/_\:::_ \ \ \:\ \    \:::__\/ \:::_ \ \ \:\ \:\ \\::::_\/_\::\ \\  \ \
 \:\/___/\\:\ \ \ \_\:\ \    \:\ \  __\:(_) ) )_\:\ \:\ \\:\/___/\\::\/_\ .\ \
  \_::._\:\\:\ \ /_ \\:\ \____\:\ \/_/\\: __ `\ \\:\ \:\ \\_::._\:\\:: ___::\ \
    /____\:\\:\_-  \ \\:\/___/\\:\_\ \ \\ \ `\ \ \\:\_\:\ \ /____\:\\: \ \\::\ \
    \_____\/ \___|\_\_/\_____\/ \_____\/ \_\/ \_\/ \_____\/ \_____\/ \__\/ \::\/
()
                                                             by coffeeandscripts
()
Initializing...
CRITICAL FAILURE...

The screen briefly flashes after the Initializing... part, if that's any help.

Here's my version info:

ppm@Y:~$ pip show sqlcrush
Name: sqlcrush
Version: 0.1.5
Summary: console based database editor
Home-page: http://github.com/coffeeandscripts/sqlcrush
Author: coffeeandscripts
Author-email: [email protected]
License: GNU
Location: /usr/local/lib/python2.7/site-packages
Requires: pymysql, sqlalchemy, psycopg2

I don't know if there are any logs sqlcrush generates. Please tell me if there are, and I will send them over.

Yavor-Ivanov avatar Nov 30 '17 09:11 Yavor-Ivanov

Same here:

sqlcrush -t mysql -d monitor -h localhost

Also this results in the same error message:

sqlcrush -t mysql -d monitor -u root -p <password> -h localhost -s /tmp/mysql.sock
$ python3 -m pip show sqlcrush
Name: sqlcrush
Version: 0.1.5
Summary: console based database editor
Home-page: http://github.com/coffeeandscripts/sqlcrush
Author: coffeeandscripts
Author-email: [email protected]
License: GNU
Location: /usr/local/lib/python3.6/site-packages
Requires: sqlalchemy, pymysql, psycopg2

This application is essentially broken.

herrbischoff avatar Jan 14 '18 15:01 herrbischoff

The issue occurs at line 371 in bin/sqlcrush file: all_tables.reflect(open_database)

denisbriand avatar Mar 02 '18 23:03 denisbriand

In /usr/local/bin/sqlcrush (that's where pip3 installed this application), change the lines:

https://github.com/coffeeandscripts/sqlcrush/blob/master/bin/sqlcrush#L927,L929

    except:
        term_scr(scr)
        print("CRITICAL FAILURE...")

to

     except Exception as e:
         term_scr(scr)
         print(str(e))                                                       
         print("CRITICAL FAILURE...")

I got the error:

(sqlite3.DatabaseError) file is encrypted or is not a database [SQL: "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name"] (Background on this error at: http://sqlalche.me/e/4xp6)

And, indeed, the db was encrypted.

This application is essentially broken.

@herrbischoff I have tested the application with simple sqlite database, just for browsing, and it worked. I wouldn't say it's broken, but I suggest the mantainers (@coffeeandscripts) to change the exception hadling like I did in my snippet so at least you know what to search for.

msdos avatar Aug 22 '18 00:08 msdos

Thank you @msdos and others. Apologies for not maintaining this well enough. I'm a final year medical student so working really hard on trying to pass exams. Also this was my second proper solo project ever, so it's a poorly written job. I definitely plan to improve it in the coming months after my exams, and have already made steps to separate everything out into cleaner and more functional modules.

Thank you for the advice, I will definitely take in on board. Please sit tight.

coffeeandscripts avatar Aug 22 '18 02:08 coffeeandscripts

You don't need to apologize, this application already helped me to solve a problem in production and I thank you for that. I just gave a specific suggestion for this specific problem.

Good luck on your exams!

msdos avatar Aug 22 '18 03:08 msdos