Issue when using Query.equal in an appwrite function using python
- 2
- Databases
- Flutter
- Functions
- Cloud
Recently I faced an issue while executing the below function to generate a unique referralCode.
`from random import Random from appwrite.services.databases import Databases from appwrite.query import Query
def generateReferralCode(client)->str: databases = Databases(client) docs = { 'total': 1, } referralCode = None while (docs['total'] > 0): referralCode = Random().randint(100000, 999999) docs = databases.list_documents('USER_DATA', 'USERDATA', [ Query.equal('referralCode', referralCode) ]) return referralCode`
It shows me this error: Invalid query: {"method":"equal","attribute":"referralCode","values":["300522"]}
my collection has the following attributes:
name: String referralCode: Integer
This code used to work fine when I wrote it a few days ago, but now it throws an error.
Recommended threads
- Worker functions stuck on "Fetched 0 fun...
Appwrite Version: 1.9.0 Bug Description: The appwrite-worker-functions container gets stuck in an infinite loop logging "Fetched 0 functions..." while scheduled...
- Upgrading selfhost version?
It is okay to upgrade version to higher one, of my current version is 1.7.4 to 1.8.1. Is that safe to do cause my clients already have data on that? Also is a...
- I am using s3 for app storage but is it ...
_APP_STORAGE_DEVICE=s3 puts everything to the s3 storage but i need to be able to keep the function builds and site in the local and not waste the cloud storage...