Thank you for taking the time to respond, I really appreciate it! On Nov 6, 2:46 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
> you should definitely create the engine and metadata on a per-process > basis. When using SQLite, the engine automatically chooses the > "SingletonThreadPool" connection pool, which will maintain a single > SQLite connection per application thread, which is never moved across > threads (unless you did so explicitly). Ah, well there is something I have overlooked. I have been forgetting that there is a connection object since I never use it directly. I was actually thinking that the engine was the connection, but I see now that is not accurate. But would I need to close the connection explicitly after each request? > The error you're getting > would only occur if you are sharing the connection returned by the > engine across threads, which can also occur if you're using a single > Session that's bound to a connection across threads. When using the > scoped_session() manager, this also should not occur - some > description of this lifecycle is > athttp://www.sqlalchemy.org/docs/05/session.html#unitofwork_contextual_... > . I do not believe that I am sharing the connection object across threads, at least not deliberately. The only sqlalchemy objects I am working with are an engine (which is stored at the process level), the metadata (which is unbound and stored at the process level), and a scoped session. At the end of each request, I call remove() on the scoped session class, which I assumed was enough. Would there be anything else I should do at the end of a request in order to "clean up"? Also, I am using Elixir. Is it possible that Elixir is holding on to a connection object I don't know about? It uses scoped sessions by default as well. Thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
