Run sqlite3 with python in command line

15,401

Solution 1

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.

Solution 2

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.

Share:
15,401
ovrwngtvity
Author by

ovrwngtvity

Updated on July 29, 2022

Comments

  • ovrwngtvity
    ovrwngtvity almost 2 years

    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