I just got python and typing:
sqlite test.db
into the shell, but I get a syntax error. What have I missed?
I just got python and typing:
sqlite test.db
into the shell, but I get a syntax error. What have I missed?
I guess that you did the following?
$ python
Python 2.7.3 (default, Sep 26 2012, 21:51:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> sqlite test.db
File "<stdin>", line 1
sqlite test.db
^
SyntaxError: invalid syntax
Try this instead:
import sqlite3
conn = sqlite3.connect('test.db')
cursor = conn.cursor()
cursor.execute('''Your query goes here''')
For more details, take a look at the sqlite documentation for python2 or python3
Python doesn't provide this command-line utility so make sure sqlite3 is in your path. Then you can either execute:
$ sqlite3 mydb.db
or if you have entered your settings in settings.py:
./manage.py dbshell