Live data from Hacker News

Marshmallow: Simplified object serialization for Python

github.com

1–10 of 16 posts

Re: Marshmallow: Simplified object serialization for Python

#8

I'm also a fan of Schematics ( https://schematics.readthedocs.org/en/latest/ ) which is more or less identical in intent

It looks good but using it in a naive manner to interface with a database, as shown in the example, without binding variables, leaving you totally open to injections is quite bad. What would be good is a lightweight binding to sqlalchemy, leaving the dangerous part to the expertsm. That said, there is a real place for this library and quite a few new ones have popped up in the last year.

Re: Marshmallow: Simplified object serialization for Python

#9
post #6

I really hate this property magic, it was bad in the Django ORM and it'll be bad in Marshmallow too. It looks nice in the examples, but then when you have to use it in anger and a certain problem requires metaclasses to fix...

Please elaborate. I share your sentiment, but I also see the value in this kind of api.

Re: Marshmallow: Simplified object serialization for Python

#10
Used it on a huge project where I wanted the interfaces clean between the Python project at runtime and to serialize the Python objects to the database. Using pickling gave me sleepless night until I moved to Marshmallow. Whilst Django REST Framework comes with a nice serializer and parser modules, marshmallow's ability to do just the part was a godsend.

This alone gave us the flexibility to expose the Python modules and objects as a simple JSON API and the DB load / save came for free.

Highly recommended.

Post reply on HN