marshmallow-sqlalchemy icon indicating copy to clipboard operation
marshmallow-sqlalchemy copied to clipboard

Use with sqlalchemy-1.1 and JSON field type

Open ewittle opened this issue 10 years ago • 1 comments

If you use sqlalchemy 1.1 (b2 in my case) with the new JSON field type, you'll get a type conversion error:

marshmallow_sqlalchemy.exceptions.ModelConversionError: Could not find field column of type <class 'sqlalchemy.sql.sqltypes.JSON'>.

In Convert.py, I added ", sa.JSON: fields.Raw" to the end of SQLA_TYPE_MAPPING in class ModelConverter, and that seems to do the trick (at least so far)

ewittle avatar Jul 27 '16 02:07 ewittle

Created a pull request for the change, modified the approach describe above a bit to avoid causing issues with versions of SQLAlchemy prior to 1.1. Tried to follow the contributions instructions, let me know what I missed.

ewittle avatar Jul 29 '16 21:07 ewittle