I would like to know if it is possible to define with SQLAlchemy the length of an enum type field. In my case the classes are defined as follows:
EnumTest.py
from enum import Enum
class EnumTest(str, Enum):
EnumTest1 = "EnumTest1"
EnumTest2 = "EnumTest2"
EnumTest3 = "EnumTest3"
TestTable.py
from models import Base
from sqlalchemy import Column, Enum, String
from .EnumTest import EnumTest
class TestTable(Base):
__tablename__ = "test"
id = Column(String(50), primary_key=True)
my_enum = Column(Enum(EnumTest), nullable=False)
My goal is to create a field called my_enum of type character varying of length 50 as in the case of the id field.