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
- Broken Appwrite can’t make functions nor...
Hii guys, I was having this issue with my locally hosted Appwrite, I can’t create functions ( both template and manual), I can’t make a custom domain ( like in ...
- Bulk operations on tables with relations
Hi, if I try to perform a bulk delete on a table with relations, I get this: `289 | if (((_b = response.headers.get("content-type")) == null ? void 0 : _...
- Getting error when trying to add domain ...
we use self hosted appwrite on my company and every single time ever I tried to add a domain it shows this error on the top rigth: "Cannot read properties of un...