Relative Content

Tag Archive for pythondatabasesqlitemachine-learningfastapi

Handle database locks in python for my labeling app

I want the user of my app to retrieve some data to labelize. In the first version, I did not implement locking so several users could access the same data at the same time and so the second one would overwrites the label of the first one.
I am using a python fastAPI sqlite backend.
I initially came up with the idea to add a ‘is-being-labelized’ value for the label, so that the next proposed data is not the same. I do not like it because I do not know how to handle the situation where the user quits the app (or other) without having labelized the data. For the moment, my best way to go is add a column with the time stamp retrieved time, and to implement a logic where let’s say 30s after having been retrieved, we check if the label is not None anymore. If it’s still None (meainig the person did not labelize), we remove the value of the time stamp . I am not fully happy neither because it does not handle the case where the person meditates and then come back to labelize the data.