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
- Cloud function deploy stucks in processi...
Been trying for the last hours to deploy my function but for whatever reason, alwasy stuck on processing!
- Increase by operators
I see appwrite have bunch of useful operators for querieng db. One more I would like to suggest is operators like increase the count of a int columns by 1,2.. ...
- One-time Cloud migration blocked by data...
Hi, I’m blocked on a one-time migration from Appwrite Cloud to my self-hosted Appwrite instance. We already fixed the region issue, and the migration now corre...