[Tutor] in-memory pysqlite databases

Dinesh B Vadhia dineshbvadhia at hotmail.com
Sat Apr 12 17:11:29 CEST 2008


Say, you have already created a pysqlite database "testDB".  In a Python program, you connect to the database as:

> con = sqlite3.connect("testDB")
> cur = con.cursor()

To use a database in memory (ie. all the 'testDB' tables are held in memory) the pysqlite documentation says the declaration is:

> con = sqlite3.connect(":memory:")
> cur = con.cursor()

But, this can't be right as you're not telling Python/pysqlite which database to keep in memory.  I've tried ...

> con = sqlite3.connect("testDB", ":memory:")
> cur = con.cursor()

.. but that didn't work.  Any ideas?

Dinesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080412/fd7df586/attachment.htm 


More information about the Tutor mailing list