How to get value or name of enum from SQLAlchemy result query?

from dataclasses import dataclass, field
from enum import Enum, auto

class GenderEnum(Enum):
    p = auto()
    l = auto()

class ActivityLevel:
    id: int = field(init=False)  # NOTE add `repr=False` if trying to display instances
    name: str
    gender: GenderEnum
from sqlalchemy import Column, Enum, ForeignKey, Integer, String, Table
from sqlalchemy.orm import registry

from .model import ActivityLevel

mapper_registry = registry()

activity_level = Table(
    Column("id", Integer, primary_key=True),
    Column("name", String(100), nullable=False),
    Column("gender", Enum(GenderEnum), nullable=False),

def start_mapper():
    mapper_registry.map_imperatively(ActivityLevel, activity_level)
from json import JSONDecoder, JSONEncoder

from .model import ActivityLevel, GenderEnum

class ActivityLevelJSONEncoder(JSONEncoder):
    def default(self, o):
        try:  # NOTE duck typing and asking for forgiveness not permission
            return {
        except AttributeError:
            return super().default(self, o)

class ActivityLevelJSONDecoder(JSONDecoder):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, object_hook=self._object_hook, **kwargs)

    def _object_hook(d: dict) -> ActivityLevel:
        return ActivityLevel(