gorilla-co / odata-query

An OData v4 query parser and transpiler for Python
MIT License
71 stars 16 forks source link

Better support for `ENUM`s #12

Open OliverHofkens opened 2 years ago

OliverHofkens commented 2 years ago

SQLAlchemy offers great support for ENUM fields, mapping them from either a list of options or a Python Enum. OData-Query doesn't utilize this feature well enough, and currently just crashes if you try to use a non-existing ENUM member.

OliverHofkens commented 2 years ago

This is partially solved in SQLAlchemy by passing validate_strings=True to the ENUM definition, which will raise LookupError when an unknown enum member is used. So this might not be our concern.

One adjacent feature that would be cool is supporting OData's enum type, which uses syntax like status eq PostStatus'DRAFT'.