On Sep 26, 2006, at 5:13 AM, seb wrote: > Looking at TG sources, I found that (if I understand well ...): > - each CP's thread starts a new connection (create_engine) and binds > metadata to the declared model, using a DynamicMetaData. This avoid > having one shared connection.
IIRC, the connections are pooled. If you're using transactions, it's not safe with *any* database to share a connection between multiple simultaneous requests. > - this can be done by using activemapper, which indirectly uses > sqlalchemy.mods.threadlocal. This creates an thread-specific > objectstore (session), which is used by the app to act on the db. > - sessions are cleared once the CP's request is done, using CP filter > (on_end_resource). We don't use the threadlocal mod. (Again, going by memory). TG just makes sure to share the same connection stuff with Active Mapper so that the user has a choice of which way to go. > Is there any other architecture that was relevant when TG has > integrated SA ? Not that I recall. > How do you deal with multiple data sources (ie. multiple db ie. > multiple dburi) ? I punted on that for now. It's a less-common case, so it wasn't a priority. TG 1.1 will let you have a different dburi for each application, at the very least. > Is there any way not to clear sessions, as it clears the SA's cache > (identity_map) or is the performance is good enough to not caching > objects ? Sessions are intended to be a "unit of work", which maps nicely to the notion of a request. To try to use them as a cache beyond a single unit of work is dangerous, because you might get stale data when you're not expecting it. Either way, caching at this level is completely application-dependent. Kevin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" 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/turbogears -~----------~----~----~----~------~----~------~--~---

