You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I checked the docs, may be I not seeing any doc for query user records via the id. (I am using the memory db)
My pydantic model
`
class User(UserBase):
id: RecordID
name: str = Field(min_length=5, max_length=100)
email: EmailStr = Field(
...,
)
projects: list[str]
created_at: datetime
model_config = ConfigDict(from_attributes=True)
`
This is my Schema
`
await db.query("""
DEFINE TABLE users SCHEMAFULL;
DEFINE FIELD id ON TABLE users
ASSERT type::is_uuid(meta::id($value));
DEFINE FIELD name ON TABLE users TYPE string;
DEFINE FIELD email ON TABLE users TYPE string ASSERT string::is_email($value);
DEFINE FIELD password ON TABLE users TYPE string;
DEFINE FIELD projects ON TABLE users TYPE array DEFAULT [];
DEFINE FIELD created_at ON TABLE users TYPE datetime DEFAULT time::now() VALUE $before OR time::now();
""")
`
I got the records created just fine and they are showing up on responses. This is one such record.
How do you query this from the table? I tried almost everything from the docs but nothing seems to work at all. I can run a SQL style query and fetch the record via name, but with ID, it really doesn't work or throws errors.
Any suggestions are welcomed please.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
I checked the docs, may be I not seeing any doc for query user records via the id. (I am using the memory db)
My pydantic model
`
class User(UserBase):
id: RecordID
name: str = Field(min_length=5, max_length=100)
email: EmailStr = Field(
...,
)
projects: list[str]
created_at: datetime
`
This is my Schema
`
await db.query("""
DEFINE TABLE users SCHEMAFULL;
DEFINE FIELD id ON TABLE users
ASSERT type::is_uuid(meta::id($value));
DEFINE FIELD name ON TABLE users TYPE string;
DEFINE FIELD email ON TABLE users TYPE string ASSERT string::is_email($value);
DEFINE FIELD password ON TABLE users TYPE string;
DEFINE FIELD projects ON TABLE users TYPE array DEFAULT [];
DEFINE FIELD created_at ON TABLE users TYPE datetime DEFAULT time::now() VALUE $before OR time::now();
""")
`
I got the records created just fine and they are showing up on responses. This is one such record.
{ "name": "John Doe", "email": "john@example.com", "id": "users:019d764a-c692-7631-a182-de9d745eb127", "projects": [], "created_at": "2026-04-10T07:28:25.238453Z" }How do you query this from the table? I tried almost everything from the docs but nothing seems to work at all. I can run a SQL style query and fetch the record via name, but with ID, it really doesn't work or throws errors.
Any suggestions are welcomed please.
All reactions