This is probably something that is staring me in the face somewhere in a doc, but it seems not possible for me to delete objects in a custom view. (and I need that view because I cannot find a way to expose sqlalchemy functions through Eve).
Now I understand things get complicated with deletes when you are working with requests, so I appreciate there may be no simple answer. Things are even more complicated because the core of this function needs to happen in an another spawned thread as it takes up quite some time ( I allow consumers to poll an endpoint for progress updates).
I have tried the following:
deleting in the view before the functions gets called. This results in the session going haywire. One
of the parent objects throws errors when accessed. Probably stuff does not get finished before my thread is spawned.
deleting within the spawned thread results in "not attached to this session" errors
setting ID to 'None' and deleting objects from the parent in the ORM only (setting the collection
empty) . Does not seem to have any impact at all, the objects retain there IDs and the parent
collection remains filled.
I hope there is something obvious that I have missed! Any wisdom that you might be able to share would be highly appreciated!
This is probably something that is staring me in the face somewhere in a doc, but it seems not possible for me to delete objects in a custom view. (and I need that view because I cannot find a way to expose sqlalchemy functions through Eve).
Now I understand things get complicated with deletes when you are working with requests, so I appreciate there may be no simple answer. Things are even more complicated because the core of this function needs to happen in an another spawned thread as it takes up quite some time ( I allow consumers to poll an endpoint for progress updates).
I have tried the following:
I hope there is something obvious that I have missed! Any wisdom that you might be able to share would be highly appreciated!
Thanks, Jeroen