I have been trying to figure it out myself for the last 2 days. I have self-hosted appwrite instance, and I am running python 3.12 function. It works great up to the point where I am trying to update or create rows in my database. This is my code:
try:
# first we need to grab environment variables and initialize our appwrite client
initialize_variables(context)
# ... boring logic here ... #
# and here is my main problem
out = "NULL"
try:
out = tablesDb.create_row(
database_id=dbId,
table_id="transform_data",
row_id=ID.unique(),
data={
"data": fft_results,
"file": fileId
}
)
context.log(f"Created transform data row")
except AppwriteException as ae:
context.error(f"Error creating transform data row: {str(ae)}")
return context.res.json(f"{out}", 500)
try:
res = tablesDb.update_row(
database_id=dbId,
table_id="files",
row_id=fileId,
data={
"is_transformed": True
}
)
context.log(f"Updated file row: {json_lib.dumps(res)}")
except AppwriteException as ae:
context.error(f"Error updating file row: {str(ae)}")
return context.res.json(out, 500)
except Exception as e:
context.error(f"Error {str(e)}")
return context.res.json({"error": str(e)})
return context.res.json(out, 201)
One issue is that update_row() part of my code returns
The row data and permissions are missing. You must provide either row data or permissions to be updated.
NO MATTER WHAT I DO.
I have tried to provide permissions as well (I have row security turned on in each table in my DB)
Also I spotted that when I log the 'out' variable I am getting 2 rows that already exists in my "transform_data" table, but it miss the newly created row.
At this point I almost gave up - i have tried to delegate update / create functionality to e.g. separate node function acting like some kind of proxy, but I had other issues with that.
I am using appwrite 1.8.1 self-hosted with proxmox and docker.
quick disclaimer: fft_results is an array of float numbers like: [1.1, 0.8]
and I also attach my schema
If anyone is able to reproduce that or share any tips - I would really appreciate that
Recommended threads
- Storage Bucket Permissions
Hey folks, when enabling CRUD on the bucket level for the role any, should the bucket be accessible when using a session client?
- Every new table and column I create says...
Every new table and column I create says "processing" and nothing progresses.
- how can i make a relationship between a ...
i want to relate the $id from users auth table in appwrite with other column in my table user_profile. because is the same user... how can i have exactly the s...