Description
Hello, thank you in advance for your help
The error message:
Failed to update record. (psycopg2.errors.InvalidTextRepresentation) invalid input value for enum enumname: "enumvalue" LINE 1:
My model:
class EnumName(enum.Enum):
enumvalue1 = 1
enumvalue2 = 2
EnumName.enumvalue1.label = "enumvalue1"
EnumName.enumvalue2.label = "enumvalue2"
I have nothing weird in my ModelView, I just want to display my column and make that enum editable.
In the edit panel, I have a dropdown displaying the values. I can modify them.
But when I click on the Save button, this error appears:
Failed to update record. (psycopg2.errors.InvalidTextRepresentation) invalid input value for enum enumname: "enumvalue" LINE 1:
In the callstack serverside, there is also a mention to sqlalchemy.exc.DataError
I guess it tries to update with a string instead of an enumvalue. But I don't get the internal with psycopg2.
I'm sorry if this ticket has already been discussed, but I can't find any information other than weird unsustainable workaround, and I'd like to avoid this kind of stuff 😄
Environment:
- Python version: 3.12.8
- Flask version: 3.1.0
- Flask-Admin version: 1.6.1
- WTForms: 3.1.2 (I fixed that due to a bug with 3.2.0, that's why I put that here)
Activity
ClementDelannoySlateDigital commentedon Feb 5, 2025
Oh, and this column was created using alembic.op on a postgresql database: