Update tuples best practices #365
Unanswered
cristianbriscaru
asked this question in
Q&A
Replies: 1 comment
-
Currently it is recommended to process the deletes in one transaction followed by doing one for the writes. We have an open idea you can follow here: https://github.com/orgs/openfga/discussions/271 which would improve this and allow a single transaction by having transactions always process deletes before writes. Currently you would likely see failures if you attempted this and any writes were attempted for existing records prior to deletion since when any one write or delete in a transaction results in a failure the entire transaction will fail. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We are trying to optimize our update tuples functionality.
At the moment when we want to update a user permissions we send a request to get all the tuples for that user than send a request to delete the existing tuples and than another request to write the new tuples but this is not ideal as it's not transactional and it also leaves the user for a brief moment without any permissions.
We where thinking to changes this by sending a request to get all the tuples for the user and than in a single request to
/stores/{store_id}/write
include in thedeletes
the old tuples and in thewrites
the new tuples. The only issue with this approach is that we are not sure in which order are thewrites
anddeletes
executed as they may contain duplicate data and we don't want thedeletes
to delete tuples from thewrites
.Can you please shed some light on this and what is the best approach to update a users tuples?
Beta Was this translation helpful? Give feedback.
All reactions