Reading a Zope ZODB from Pyramid?

24 views
Skip to first unread message

Laurent DAVERIO

unread,
Jul 30, 2018, 12:01:58 PM7/30/18
to pylons-discuss
Hello list,

this may be a very silly question, and if so I apologize in advance, but
I'm not sure what to google.

Is it reasonable to try and read data from the ZODB of a Zope/CMF
instance directly from Pyramid, or should I write export routines in the
Zope app?

Thanks in advance,

Laurent.

Gael Pasgrimaud

unread,
Jul 30, 2018, 12:16:22 PM7/30/18
to pylons-...@googlegroups.com
Hi,

On Mon, Jul 30, 2018 at 06:01:54PM +0200, Laurent DAVERIO wrote:
> Hello list,
>
> this may be a very silly question, and if so I apologize in advance, but
> I'm not sure what to google.
>
> Is it reasonable to try and read data from the ZODB of a Zope/CMF
> instance directly from Pyramid, or should I write export routines in the
> Zope app?

ZODB use pickle to store your objects' instances. This mean that you'll need
to make available all the classes (python code) used by Zope/CMF to
deserialize objects in your pyramid app.

This maybe painfull but it seems doable since Zope/CMF are now available as
packages on pypi.

The easy way to try this is probably to install pyramid in your current
Zope/CMF venv, write a minimalistic pyramid app to access your ZODB, and
start it from this venv.

Hope this help.

>
> Thanks in advance,
>
> Laurent.
>
> --
> You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discus...@googlegroups.com.
> To post to this group, send email to pylons-...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/e29375c6-7f65-4544-dbac-eae666f6517d%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.

Tres Seaver

unread,
Jul 30, 2018, 12:18:43 PM7/30/18
to pylons-...@googlegroups.com
On 07/30/2018 12:01 PM, Laurent DAVERIO wrote:

> this may be a very silly question, and if so I apologize in advance, but
> I'm not sure what to google.
>
> Is it reasonable to try and read data from the ZODB of a Zope/CMF
> instance directly from Pyramid, or should I write export routines in the
> Zope app?

If you install all the Zope + CMF code such that it is importable from
within your Pyramid app, then you could just load the objects normally
(unpickling requires finding the class)

Reading pickle data (vs unpickling the instances) is a tricky problem, and
not one I'd be excited to tackle.


Tres.
--
===================================================================
Tres Seaver +1 540-429-0999 tse...@palladion.com
Palladion Software "Excellence by Design" http://palladion.com

Laurent DAVERIO

unread,
Jul 31, 2018, 6:08:34 AM7/31/18
to pylons-...@googlegroups.com
Thank you very much Gael,

I vaguely remembered about pickles, thanks for pointing that out. Unless
I'm mistaken, Python 2 and 3 use different pickling formats, so my
Pyramid app would also have be downgraded to Python 2...

Maybe I should try something else, after all.
Thanks for your help,

Laurent.

Laurent DAVERIO

unread,
Jul 31, 2018, 6:12:46 AM7/31/18
to pylons-...@googlegroups.com
Thank you very much Tres,

I think I'll choose a safer/saner way, even if I would have loved being
able to access the ZODB data directly...

Thanks for your help,

Laurent.


Reply all
Reply to author
Forward
0 new messages