Harish Vishwanath wrote: > Hello, > > Thanks for your suggestion. I wanted to ask one more thing. > > I am using Sqlite with SQLA. Its a multi threaded application, but each > thread gets its own session/engine. But, since it is Sqlite, isn't there > just only one connection?
sqlite very much wants each connection object to be used only within one thread. SQLA's pool implementation for SQLite, SingletonThreadPool, ensures this is the case. As long as you are using a file-based SQLite database, each connection references the same file. If you're using an in-memory sqlite database, multithreaded access to such a thing is not supported by sqlite at all, actually. I had just located this on the pysqlite list some weeks ago in response to someone's question. There may be some "experimental" options on pysqlite to support this but I'd have to re-locate that email thread to check. If you wanted everyone to use the identical connection regardless of thread, use the StaticPool. > Adding a Pool Listener, will make extra function calls every time a > connect() is requested. This is an embedded system, and I am little > worried > if that could degrade performance. Would appreciate your comments! it won't degrade performance. that call only occurs when the actual SQLite connect() function is called. In reality, SQlite makes connections extremely fast and you could even go with the NullPool approach (no pooling), connect to the file on every connect() call and set the little 'str' type processor each time - you'd barely notice any difference. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---