Dinesh B Vadhia wrote:
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.
The documentation says "Creating an in-memory database". That means (to me) a new database that is memory resident and as consequence is empty to start and goes away when the connection goes away.

I don't see any easy way to load a file-based db into a memory-based one. Seems like you'd need to create all the tables in memory, then run select cursors to retrieve from the file-based db and insert the rows into the memory-based db tables

Why do you want it in memory?

[snip]
-- 
Bob Gailer
919-636-4239 Chapel Hill, NC


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to