On Sat, Aug 20, 2011 at 12:02 PM, Dirk Makowski <[email protected]> wrote: > Hello, > working with ZODB has brought up some questions. They are related to Pyramid > which is why I'd like to ask/discuss them here. > 1) The ZODB docs state that the db needs some kind of vacuum from time to > time, which is done by db.pack(). From a Pyramid app, how can I obtain that > handle to the database connection? As I understand it, that handle is hidden > somewhere inside PersistentApplicationFinder And would it be advisable to do > a pack from inside the Pyramid app, when some of the stored objects my be in > use by the app itself, like those objects in traversal's lineage? (Deleting > such will have strange effects, I experienced that already ;)
I never have used it but I've heard people in the Plone/Zope world running repozo script through a cron job for automatic packing and backups of ZODB: http://wiki.zope.org/zope2/RepozoPy I think there were some discussioin about deprecating repozo but I think it still comes with the latest ZODB release. > 2) The WSGI pipeline as described in the tutorials (and the paster template) > use egg:repoze.zodbconn#closer. Would it be possible in Pyramid to use > egg:repoze.zodbconn#connector instead (or additionally?) Connector would put > the connection in the WSGI environment. I don't understand this question. > 3) By request.root we have access to the root object of the resource tree > for traversal. Now, appmaker() receives as argument "zodb_root". Is it > possible to obtain "zodb_root" from elsewhere, so I could store objects in > ZODB that are not part of the resource tree? You can directly connect to ZODB as described in ZODB docs to get the root: http://www.zodb.org/documentation/tutorial.html#configuration This is independent of Pyramid and PasterScript. Remember that in order to connect to ZODB with more than 1 process you need to run ZODB in ZEO mode. With repoze.zodbconn you can also use the same configuration you have in your Pyramid application to get the ZODB root. > I hope you don't mind me asking so many questions. > Thanks for your patience and help. > Dirk In my experience the best to way to learn about how these ZODB connections work with Pyramid is by setting an ipdb trace where the Pyramid WSGI is configured and playing with the ZODB API at different connection levels. http://pypi.python.org/pypi/ipdb Hope it helps. > > -- > You received this message because you are subscribed to the Google Groups > "pylons-discuss" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/pylons-discuss/-/I8y_rHZj8L0J. > 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/pylons-discuss?hl=en. > -- Danny Navarro | http://dannynavarro.net -- You received this message because you are subscribed to the Google Groups "pylons-discuss" 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/pylons-discuss?hl=en.
