help with ^ython database Axidrawer

Dear Python forum,

I am seeking help with a problem I have been struggling with for days. I have created a small website with the help of a teacher, where you can upload an image, convert it to various SVGs with some parameters, and store them in Firebase. Then, the colors are separated and printed by an Axidrawer. The system works, but once I have printed the layers of the SVGs with the Axidrawer, I want the SVG in Firebase to be marked as ‘printed’. This way, the system won’t attempt to print the same image again.

I have never worked with Python before, so I am struggling to figure this out!

Could you please help me?

Here is the GitHub URL so you can review the files:

Sorry if this is a silly question.

Your question appears to be asking how to update the data in your Firestore database?

In the code you appear to be querying and downloading only those items that have the “status” field equal to “ready-to-print”. So, after downloading, you want to keep track of the database doc ids (or document names), and then after successfully printing the data, you need to update that “status” field to something like “printed” (or another appropriate string value different from “ready-to-print”). To do the update, using python, see the docs at Add data to Cloud Firestore  |  Firebase

In your code you are using REST calls to query the db. It might actually be easier to use a db client (see the same doc link), but that requires completely rewriting the download code too. If you want to keep the REST calls, then the document update method apparently is called patch.

Instead of using the document ids (names) to see which docs needs to be updated, after printing, you could also query again, using the svg url fields as filter. That’s probably the simplest way (download code then doesn’t need to be modified).

Most simple + efficient may be to use batchWrite after printing all the svgs. This updates a bunch of documents in bulk.