marshmallow-sqlalchemy
marshmallow-sqlalchemy copied to clipboard
Set schema partial attribute in Meta class
Is it possible to set the schema.partial attribute in the Meta class for SQLAlchemyAutoSchemas?
I would like to use SQLALchemyAutoSchemas with frameworks that don't allow me to set partial=True in the load_instance call (because it is done automatically) -- that setting is inherited from the schema definition. It seems like it might not be possible to set partial=True for a SQLAlchemyAutoSchema directly.
If this is not possible, could the Meta class be improved to support this?
Any update on this?
Due to another limitation of ma-sqla (multiple variations on a schemas will trigger a naming collision warning), it is not really practical to use MySchema and MySchema(partial=True) in the same REST API (having both is a typical pattern to support CRUD endpoints).
But as mentioned above, defining a class MySchemaPartial(MySchema) that sets partial = True in Meta does not seem to work…
Edit: Possibly related (and dependent) on: https://github.com/marshmallow-code/marshmallow/issues/2103
Yes. Let's tackle this in https://github.com/marshmallow-code/marshmallow/issues/2103 first.