Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run sqlite3 with python in command line

I installed python3.3 and I am learning django 1.5x. I chose sqlite3 to learn with django and I am running python, django - and trying to run - sqlite3 in command line at windows. All the problem is: where is the file of sqlite3 to run a command like > sqlite3 my_db ?? I tried to found at C:\Python33\Lib\sqlite3;C:\Python33\Lib and search at windows explorer but I really can't find. I am running my projects at C:\projects\mysite

like image 967
ovrwngtvity Avatar asked Jun 09 '13 00:06

ovrwngtvity


People also ask

How do I run a SQLite client from command line?

If you are using Linux or a Mac, open a terminal window instead a command prompt. Open a command prompt (cmd.exe) and 'cd' to the folder location of the SQL_SAFI. sqlite database file. run the command 'sqlite3' This should open the SQLite shell and present a screen similar to that below.

How do I access sqlite3 from command line?

Start the sqlite3 program by typing "sqlite3" at the command prompt, optionally followed by the name of the file that holds the SQLite database (or ZIP archive). If the named file does not exist, a new database file with the given name will be created automatically.


2 Answers

Assuming that you want to inspect the database created by django, and assuming that the sqlite executable is installed, you can do the following to run sqlite in the command line:

./manage.py dbshell

More information on this command can be found in the django documentation.

like image 85
NT3RP Avatar answered Oct 20 '22 15:10

NT3RP


Python itself dosen't contain a sqlite3 command.

But the SQLite library includes a simple command-line utility named sqlite3 (or sqlite3.exe on windows) that allows the user to manually enter and execute SQL commands against an SQLite database. You can download it from here.

like image 41
selfboot Avatar answered Oct 20 '22 15:10

selfboot