Skip to content

Allow custom type converters

Prior to 0.1.0b3, custom types (e.g. something from GeoAlchemy) would crash, being unable to serialize WKB to json. b3 fixes this by checking against known serializable types, and if nothing matches, try to convert it to str.

It would be preferable to use SQLAlchemy's type system to handle this, but I'm not sure that it's possible. More investigation is needed.

The alternative would be to set up a mapping of type name (str) to callable that can be customized. It should be able to be set globally, or per model. to_dict() will check the model's type converter mapping, then the global, then try str.

Edited by Matt Sandwich