Skip to content

LookupError: 'time-geospatial' is not among the defined enum values. Enum name: featuretype. Possible values: GEOSPATIAL, TIME_GEOSPA.. #680

Closed Answered by hohobilly
rojo1997 asked this question in Questions
Discussion options

You must be logged in to vote

For those who are running into the same issue because your database column has varchar type instead of enum:

The root cause is probably from 0.0.9, a change in enum type checks ordering was introduced. It used to be checking String first and determine the type as sqlalchemy.types.String. After 0.0.9 it returns sa_Enum(enum.Enum) instead.

Overriding the sa_type or sa_column manually worked for me:

from sqlmodel import Column, Field, SQLModel
from sqlmodel.sql.sqltypes import AutoString

class Feature(SQLModel, table=True):
    ...
    # If define sa_type
    feature_type: FeatureType = Field(sa_type=AutoString) # or sqlalchemy.types.String
    # If define sa_column
    feature_type: Featur…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by rojo1997
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
3 participants