On May 23, 2012, at 10:34 AM, pr64 wrote: > Running on a linux sever, the unit test use the code above > (create_engine('sqlite:///' + database, ...) ) but the database dir > storage is /dev/shm which is a ram directory, but i wonder sqlite does > not even know that it is a ram disk.... > > Anyway, the '(Programming Error): Cannot operate on a closed database' > occurs on our real app (same code: create_engine('sqlite:///' + > database, ...) ) which runs on a normal dir (hard disk). > > We tried to switch from SingletonThreadPool (which raises errors, > sometimes) to StaticPool... we'll see what happens. The problem is > that this error is not systematically raised and it seems that it is > raised when multiple threads are accessing the db.
StaticPool can't be used for a multithreaded application, a connection can only be used in one thread at a time. pysqlite specifically should be even preventing that connection from being used in any thread in which it wasn't created. If you're using a file based database, you should be on NullPool - pooling for SQLite isn't really appropriate. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.