
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
- DigitalOcean Droplet SMTP failure with m...
Is there any way to get the appwrite 1.6 mailer docker image working on a droplet? I can send emails via the appwrite console, but my magiclinks always fiail wi...
- unable to remove project 500 error
We are unable to remove a project, when clicking setting option it showing 500 Server Error
- How to run queries to get the storage li...
I installed the n8n (self-hosting) and community node n8n-nodes-nappwrite. I tried to get the storage list files more than 25 records. But I cannot find the w...
