[Python-ideas] interactive sqlite3 module

Andrew Barnert abarnert at yahoo.com
Wed Jun 26 00:51:04 CEST 2013


From: ZeD <zak.mc.kraken at libero.it>

Sent: Tuesday, June 25, 2013 5:33 AM


> It would be useful (for the times when you have python installed but not a
> sqlite executable... think windows...) to add a minimal interactive sqlite
> interpreter... a (really) basic implementation is something like the source
> below... 

I think it would be more useful if you added this:

     if len(sys.argv) > 2:
         for command in sys.argv[2:]:
             # execute the command and display the rows
         sys.exit(0)

Personally, I've often found myself wanting to run a simple query against my Python program's database, but I was on Windows. If I could do this:

    python -m sqlite3 foo.db 'SELECT * FROM Employees WHERE joined >= "2013"'

… I definitely might do it.

But for anything more complicated than a trivial single select, I'd probably still just go download a sqlite3 binary.


More information about the Python-ideas mailing list