
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
- SMTP Error: Could not connect to SMTP
My appwrite self-hosted instance on DigitalOcean cannot sennd emails. The following results were performed Log: ``` docker compose logs -f appwrite-worker-mail...
- Cannot create a user
Hi, I am using a lowcoder frontend and trying to create a user in Appwrite (python function). Unfortunately, all I got is an error: "Raw body: Error". It means...
- Invalid credentials after migration
Hi everyone! After migrating our self-hosted Appwrite 1.3.1 to another server (staging, so a different domain), we are now getting 'Invalid credentials' when ...
