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

How to integrate with PickleType

Open kaito-albert opened this issue 5 years ago • 1 comments

I want to pass a list to the schema which uses SQLAlchemy's PickleType column. The json file will looks like this:

json_data = {uuid: '123456...', coords: [[x1, y1], [x2, y2]]}

But looks like ma.SQLAlchemyAutoSchema treat PickleType column as string so if I do schema.load(json_data) it will say coords is not a valid string. I use some trick like str(json_data(coords) before schema.load(json_data) and eval(json_data(coords) after. But when I do schema.dump(model), it will still convert coords to string. And I have to eval it again. Is there better way to to integrate with PickleType? Or is there any way to skip the validation for specific column.

kaito-albert avatar Oct 02 '20 08:10 kaito-albert

I have the same problem. Did you ever find a better solution?

iFreilicht avatar Oct 15 '21 15:10 iFreilicht