Skip to content

Instantly share code, notes, and snippets.

@freegor
Last active May 20, 2022 21:04
Show Gist options
  • Save freegor/933def0ad41a5db7bed66e29acebb096 to your computer and use it in GitHub Desktop.
Save freegor/933def0ad41a5db7bed66e29acebb096 to your computer and use it in GitHub Desktop.
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