How to use marshmallow to serialize a custom sqlalchemy field?

后端 未结 2 1869
盖世英雄少女心
盖世英雄少女心 2021-01-05 23:44

I just start a simple project called flask_wiki this days and I\'m using some flask extensions as the follows:

  • Flask-SQLAlchemy
  • Flask-Restful
2条回答
  •  旧巷少年郎
    2021-01-06 00:14

    According to what I've read in the docs, you can specify a model_converter attribute in your ModelSchema Meta class. The ModelConverter class has a SQLA_TYPE_MAPPING attribute you can override in a subclass to add your custom GUID field to the types detected by the automatic schema generator.

    That said, I've never used it so I don't know if this will work or not.

提交回复
热议问题