marshmallow-code / marshmallow-sqlalchemy

SQLAlchemy integration with marshmallow
https://marshmallow-sqlalchemy.readthedocs.io
MIT License
549 stars 94 forks source link

The function decorated by the "post_load" decorator will undergo changes in parameter types as the function name changes. #545

Closed LionSniper closed 6 months ago

LionSniper commented 7 months ago

class AdGroupUpsertSchemaV3(ma.SQLAlchemySchema): name = fields.String(required=True)

class Meta:
    model = models.AdGroup
    fields = 'name'
    load_instance = True

@post_load
def a(self, data, *args, **kwargs):
    print(type(data))
    return data

flask-marshmallow==0.14.0 marshmallow==3.17.0 marshmallow-sqlalchemy==0.28.1

like the code above,when post_load decorator func name is a-m, data type is dict, when func name is n-z, data type is <class 'modules.advertising.group.models.AdGroup'>

why why why?

deckar01 commented 7 months ago

Duplicate of https://github.com/marshmallow-code/marshmallow-sqlalchemy/issues/502.