marshmallow schema for Joined Table Inheritance (SQLAlchemy + marshmallow)

205 views Asked by At

I have a schema similar to

class Employee(Base):
    __tablename__ = 'employee'
    id = Column(Integer, primary_key=True)
    name = Column(String(50))
    type = Column(String(50))

    __mapper_args__ = {
        'polymorphic_identity':'employee',
        'polymorphic_on':type
    }

I have tables Engineer and Manager which inherits from Employee

Reference: SQLAlchemy 1.3 Documentation

I want to define a marshmallow schema

from marshmallow import fields, Schema

class EmployeeSchema(Schema):
    """
    Employee Schema
    """
    id = fields.Int(dump_only=True)
    name = fields.Str(required=True)
    type = <???>
0

There are 0 answers