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
- Function domain not available
Hello, even tho in docs you clearly describe that every function has its domain, I can not see it anywhere in any of my projects. How do I reveal the url of th...
- Inquiry: How to Reduce Cold Start Durati...
Hey! I was using Python for the function runtime, but after reading that Go has the fastest runtime, I switched my code over to Go. However, I'm still seeing co...
- Relation Question
How do I create a relation from table y to an others x.$id. in my example I have a users table where I use Appwrites unique User IDs and I want other tables fo...