On 15.09.2015 22:20, Paul Kraus wrote: > Is there a way to easily turn a sqlalchemy model object into a > dictionary/JSON?
That is actually something I really need(ed), too - I want to send SQLAlchemy objects to Celery workers that have no access to the database. Because I had some deadlines, I hacked something together myself quite quickly: https://github.com/moschlar/SAUCE/blob/feature/queue/sauce/lib/serialize.py though I'm not overly happy with this. But before that, I tried to evaluate libraries that are focused on object serialization: - http://docs.pylonsproject.org/projects/colander/en/latest/ and http://colanderalchemy.readthedocs.org/en/latest/ - https://marshmallow.readthedocs.org/en/latest/ and http://marshmallow-sqlalchemy.readthedocs.org/en/latest/ but neither of them really worked OOTB with my model. You mileage may vary! ;) (Especially if you only need it in one direction, a.k.a. as_dict!) I also had a look at http://pyyaml.org/ because it (now at least) also seems to handle object references pretty well so it might be a good choice for circular references. So if someone has some experience on this topic, I'd also be glad to hear about it! ;) Best wishes, -- Moritz Schlarb -- You received this message because you are subscribed to the Google Groups "TurboGears" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/turbogears. For more options, visit https://groups.google.com/d/optout.

