0

I've got flask-marshmallow of 0.13.0 version

I'm able to access SQLAlchemyAutoSchema in the flask app

when i try to run the application, i get the following error

AttributeError: 'Marshmallow' object has no attribute 'SQLAlchemyAutoSchema'

initialisation of flask marshmallow

    from flask_sqlalchemy import SQLAlchemy

    from flask_marshmallow import Marshmallow
        
    db = SQLAlchemy()
    ma = Marshmallow()

I've registered both db and ma with flask app code:

from apis import ma

from apis.models import User


class UserSchema(ma.SQLAlchemyAutoSchema):
    class Meta:
        model = User
  • Is `marshmallow-sqlalchemy` installed? See https://github.com/marshmallow-code/flask-marshmallow/blob/dev/src/flask_marshmallow/__init__.py#L25 – MatsLindh Jan 26 '21 at 14:43

1 Answers1

0

flask-marshmallow has a dependency on marshmallow-sqlalchemy for the SQLAlchemySchema classes to be defined.

Make sure you also install marshmallow-sqlalchemy.

MatsLindh
  • 49,529
  • 4
  • 53
  • 84