You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since we're already using attrs, there would be several potential benefits from using cattrs, which could be considered a pre-serialization/post-deserialization optimization step. It uses attrs definitions to recursively unstructure classes and nested data structures into dicts and builtin types, and vice versa. In relational db terms, this is similar to adding a serialization library (like Marshmallow) on top of an ORM framework (like SQLAlchemy), but without needing to define a separate model + serialization schema. There are some more details on how it works in this article.
This would make both serialization and deserialization a little more efficient, avoid some edge cases inherent with pickling (or more specifically unpickling classes), and open up the possibility for other serialization formats like JSON.
The text was updated successfully, but these errors were encountered:
Since we're already using
attrs
, there would be several potential benefits from usingcattrs
, which could be considered a pre-serialization/post-deserialization optimization step. It usesattrs
definitions to recursively unstructure classes and nested data structures into dicts and builtin types, and vice versa. In relational db terms, this is similar to adding a serialization library (like Marshmallow) on top of an ORM framework (like SQLAlchemy), but without needing to define a separate model + serialization schema. There are some more details on how it works in this article.This would make both serialization and deserialization a little more efficient, avoid some edge cases inherent with pickling (or more specifically unpickling classes), and open up the possibility for other serialization formats like JSON.
The text was updated successfully, but these errors were encountered: