[Tutor] sqlite3 question

Joel Goldstick joel.goldstick at gmail.com
Wed May 23 18:51:41 CEST 2012


On Wed, May 23, 2012 at 12:11 PM, Khalid Al-Ghamdi <emailkgnow at gmail.com> wrote:
> hi all,
>
> I'm using Python 3 and have read that you need sqlite to be installed to use
> the sqlite3 module, but when it is imported it seems to work ok. so, do you
> need to install it? also, when you create the database where is it saved?
>
>
> thanks
Here's one of the top listings from google for sqlite3 python

http://greeennotebook.com/2010/06/how-to-use-sqlite3-from-python-introductory-tutorial/

See that the database is kept in the file /home/user/mydatabase.db

>>> import sqlite3
>>> mydatabase="/home/user/.mydatabase.db"
>>> connection=sqlite3.connect(mydatabase)
>>> cursor=connection.cursor()
>>> cursor.execute('CREATE TABLE mytable (Id INTEGER PRIMARY KEY, Date TEXT, Entry TEXT)')
<sqlite3.Cursor object at 0xb7cd7140>
>>> connection.commit()
>>> cursor.close()
>>> quit()
-- 
Joel Goldstick


More information about the Tutor mailing list