Last active
May 20, 2022 21:04
-
-
Save freegor/933def0ad41a5db7bed66e29acebb096 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas | |
from pydantic import BaseModel | |
class Dataset(BaseModel): | |
id: str | |
name: constr(max_length=128) | |
dataframe: pandas.DataFrame | |
@validator('id') | |
def is_uuid4_string(cls, value): | |
try: | |
UUID(value, version=4) | |
except ValueError as ve: | |
raise ValueError('The id value is not uuid4') from ve | |
return value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment