openfga / roadmap

OpenFGA Public Roadmap
2 stars 0 forks source link

Async Bulk Delete API #34

Open aaguiarz opened 1 year ago

aaguiarz commented 1 year ago

Tuples can only be deleted individually.

If you want to delete a set of tuples, you need to first find them (by using the read API, or by construct them from data in your databases), and then call the write API with a set of tuples to delete.

We should provide a way to batch delete tuples, based on different conditions. Conditions should be consistent with the ones we have in the Read API.

This would be an async API, where you'd be able to query for status or get notified after it finishes.

Open questions:

ericmoraitis commented 5 months ago

Adding my feedback after a discussion with Andres:

Hope this helps!

rhamzeh commented 5 months ago

@ericmoraitis have you looked at our SDKs by any chance? Curious to know your thoughts about the semantics there.

All 5 of them support what we call non-transactional writes if you pass in the proper options. See here

We're trying to understand if: 1) the semantics exposed by the SDK are good enough as an interface or if we should iterate on them (any future API would probably use the same semantics) 2) Whether there is a need for this to be handled by the API instead of the SDK

If you are using one of the supported languages (JS, Go, .NET, Python, Java), try them out and let us know!

aaguiarz commented 5 months ago

A similar idea would be to provide a 'Bulk Transform API', were you can specify a query and a transformation to apply (e.g. for each tuple you find, add a transformed one).

This can be useful for model migrations where you need to rename a relation/tuple. In those scenario you'd first want to create tuples for the new relation/type, then deploy the new version of your app that uses and point to the new model.

You'd delete the tuples after the new version is deployed.