Hi, I'm currently developing a web application using TurboGears which makes use of sqlalchemy (0.4.6). Turbogears exposes a global 'session' object, which is initialised as scoped_session(sqlalchemy.orm.create_session()). E.g. each thread gets its own session object.
Other web-accessible applications need to make use of this very same session object as well, and they can receive many concurrent connections. Each such connection needs a session object. As I can see, the turbogears way of creating the session as I described above does not use a connection pool. First of all, am I right to assume this? The default way is to create a new connection to the database whenever a session object is instantiated this way? Since it seems to me that using a connection pool would be a good thing performance-wise, given that many sessions are needed, I changed the turbogears code to make use of the QueuePool class for connection pooling. This, however, has the (undesired) side effect that connections drawn from the pool at the start of each web application's request contain cached database information. In my application, I have to explicitly issue a close() at the start of each request to delete the cache and any lingering transaction states etc. It's not trivial to issue a close() at the *end* of each request, hence at the start. Now, of course, I can hack this into the turbogears session initialisation as well. But I wonder, is using a connection pool still a good idea in this case? Is fetching a session from a pool and always closing it at the start of each application request more sane than simply opening a new connection to the database? Or is there another option that I am not currently seeing? Best regards, Bram --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---