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

Is marshmallow compatible with SQLAlchemy imperative (aka classical) mapping ?

Open evoludigit opened this issue 4 years ago • 1 comments

Hello,

I am building my first api, from a quite complex model (45+ domain objects) - and I would to know if marshmallow could fit my need as I have not found the answer elsewhere.

I use SQL Alchemy with an imperative mapping style: domain objects are defined in domain/model.py while tables are defined in adapters/orm.py.

Each domain object class is then explicitly mapped to its corresponding table.

All the examples I have seen use SQLAlchemy declarative mapping.

Is it possible to use marshmallow, especially the SQLAlchemyAutoSchema, with SQLAlchemy imperative mapping ?

thanks a lot for your help.

evoludigit avatar Oct 08 '21 09:10 evoludigit

i don't have much experience with the imperitive mapping style. you could try passing you model classes as the model for SQLAlchemySchema. if anyone attempts this, please report back!

sloria avatar Jan 12 '25 05:01 sloria