[sqlalchemy] sqlite in memory

2013-06-17 Thread Richard Gerd Kuesters
hi! curiosity [that may help me, lol]: is there a way to create a sqlite database in memory, then save it to disk after initial inserts are done? let's say I have around 2 gb of data to insert and ... it takes like forever. i still have not convinced my boss to buy a ssd, so ... :D cheers,

Re: [sqlalchemy] sqlite in memory

2013-06-17 Thread Petr Viktorin
You can tell SQLite to disable syncing and journalling, it should get very fast then: if session.connection().dialect.name == 'sqlite': session.connection().execute(PRAGMA synchronous=OFF) session.connection().execute(PRAGMA journal_mode=OFF) Of course, your data will be

Re: [sqlalchemy] sqlite in memory

2013-06-17 Thread Richard Gerd Kuesters
Hmmm, never knew of that. All my constraints are already predefined and inserts are in order so I won't get a broken FK. I'll try that too see if it increases the speed (decreasing my headaches per build, lol). Thanks a lot, Petr! On 06/17/2013 11:18 AM, Petr Viktorin wrote: You can tell

Re: [sqlalchemy] sqlite in memory

2013-06-17 Thread Richard Gerd Kuesters
Petr, just found something intesting that may work for anyone: http://blog.marcus-brinkmann.de/2010/08/27/how-to-use-sqlites-backup-in-python/ I was able do create a database totally in memory and them just dump it to a file. The process now takes about 5 minutes, against one hour+ that it

[sqlalchemy] sqlite in memory db problems . sample code.

2008-10-15 Thread Diarmuid
I found a post saying this is not possible, but some code might be useful for others Any suggestions on using a (any) database on a readonly (compact flash) drive. Is there a pure python database that works in memory. from sqlalchemy import * import threading #The following line works fine db =