Skip to content

Using Related(column=...) with non-standard column types #478

@AbdealiLoKo

Description

@AbdealiLoKo

I have a model which uses EnumType from sqlalchemy called category.
When I try to dump some information in my schema with Related(column='category')
It throws an error that Enum cannot be serialized to JSON

Is there a way for me to let ma-sqla know that this field should be dumped using a field I have created called EnumField which handles the serialization and deserialization logic ?

I guess Related is currently assuming it can take the value from the DB directly. So, maybe we need a Related(column='category', column_field=EnumField) or something which is used to serialize/deserialize the value

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions