Hey, how do I create pydantic models for collections when $id
is a field, because I can't use $id
as a var name and Pydantic seems overly complex on trying to get it to work
class Standard(BaseModel):
id: str
standardCode: str
standardText: str
topics: List[str]
objectives: List[str]
class Config:
fields = { 'id': '$id' }
valid_data = Standard(data).dict(by_alias=True)
Sounds fine but this isn't really an Appwrite question. Maybe a pydantic forum might be more helpful
well
the problem is the id's are stored as $id
And?
Maybe you can look at field aliases: https://docs.pydantic.dev/latest/usage/fields/#field-aliases
I did that, it then complained that id
wasn't being set or something, we messed with it for 30-45 minutes before giving up and ust removing the ID
I was posting here hoping someone had tried to use a JSON Serializable class with their database fields because.. that's how it should be done
Recommended threads
- Realtime with multiple connections
I need the Realtime on multiple Collections for diffrent applicational logic. So my question is: Is there a way to have only 1 Websocket connection or do I need...
- Can't login or deploy functions in Appwr...
Hello, since i updatet to the appwrite cli 6.1.0 i can't login or deploy functions with the cli. When i call the command: "appwrite get account --verbose" i ge...
- Create admin user?
I'm not really sure how this is supposed to work, I installed Appwrite through docker-compose and set it up. When I launched the app and went into it, I created...