Can I use pydantic models using constant names and later referencing them using their value?
An example is worth more than a thousand words:
Is there a way to do this:
from pydantic import BaseModel
COLUMN_MEAN = "mean"
COLUMN_LENGTH = "length"
class Item(BaseModel):
COLUMN_MEAN: float
COLUMN_LENGTH: int
But later, when using the model, doing it like this:
Item(mean=2.1, length=10)