I'm using python appwrite function.
Error:
appwrite.exception.AppwriteException: Invalid query: Attribute not found in schema: _createdAt
Code:
results = Databases(client).list_documents('DATABASE', 'COLLECTION', [
Query.and_queries([
Query.equal('id', [user['$id']]),
Query.between('$createdAt', start_iso, end_iso)
])
])
For date conversion: datetime.now().isoformat()
Is it not just and? In the docs I'm not seeing and_queries
Query.and([
Query.equal('id', [user['$id']]),
Query.between("$createdAt", start_iso, end_iso)
])
I'm on v1.5.7 self-hosted appwrite version. Using python sdk v5.0.3
I just checked even in Python SDK v6.1.0; it's the same. However, the documentation has and only
I think the documentation is incorrect. In Python, or and and are built-in keywords.
Facing issue with querying the database "$createdAt"
https://dev.to/appwrite/introducing-createdat-and-updatedat-on-each-resource-5pa
Reading the article, as far as I understand, createdAt is stored as a timestamp. Have you tried datetime.now().timestamp() for your inputs ?
Yes, I did this and got the following error:
appwrite.exception.AppwriteException: Invalid query: Query value is invalid for attribute "$createdAt"
Then I looked at different github issues and there they mention to have iso format string
It's the same issue with almost all the query functions. It seems like $createdAt is not accessible or not available for querying.
Can any core member confirm this?
Does moving it outside of the and result in anything else?
If you remove it entirely does your first query work?
Yes, it works outside. Only happens on nested queries
For my use case, this works. Based on the documentation: Each query method is logically separated via AND operations. For OR operation, pass multiple values into the query method separated by commas
I'm not sure, it sounds to me like an issue with and, you might make an issue on github for it? Or see if one already exists.
Recommended threads
- Issue with OAuth 2.0 authentication
Good evening, I’m reaching out because I’m having a small issue with Appwrite. I’m trying to set up OAuth2 with Twitch, and even though I’m entering the correc...
- What's the proper way to delete user acc...
I would like to provide an option for the users of my app, to completely remove theirs account if they want to. I don't want to 'deactivate' the account, but to...
- Prevent Appwrite from pulling weekly unu...
Hi, I only use node/php runtimes for functions and static-1/node for site. However, appwrite keeps pull gigabytes of runtimes. It makes my VM backup unnecessar...