Re: how to get current database connection associated with current thread
Jason Madden <[email protected]>
| Newsgroups | gmane.comp.web.zope.zodb |
|---|---|
| Message-ID | <[email protected]> |
> On Aug 24, 2016, at 09:06, Sanjay Rao <[email protected]> wrote: > > how to get current database connection associated with current thread ? > Which API to use ? I believe that ZODB itself doesn't have the concept of a "current database connection associated with current thread". For something like that, you'll need to look to a higher level, depending on your application and what (if any) framework you are using. As one (not necessarily good) example, in Pyramid, you might use a tween or middleware to place the opened connection on the request, and then use `pyramid.threadlocal.get_current_request()` to retrieve the threadlocal request and access the connection from it. -- You received this message because you are subscribed to the Google Groups "zodb" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.