Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

How is partition delete supposed to work with hierarchical partitions? #3

Open
vit-svoboda opened this issue Jan 7, 2022 · 3 comments

Comments

@vit-svoboda
Copy link
Collaborator

vit-svoboda commented Jan 7, 2022

Hi,
I have another question. There's an upcoming feature allowing to delete all documents within a single logical partition (afaik also still in preview). Should be surfaced as DeleteAllItemsByPartitionKeyStreamAsync in the SDK if I'm not mistaken. I was unable to test this, most likely due to the documented limitation of partition key having to be specified in the query. But in theory, are these two features designed to eventually work together? Can I specify only the first part of the multi-level hierarchical partition key and have wiped all the sub-partitions?

Edit: fixed the first link.

@SrinikhilReddy
Copy link
Contributor

Hi,

We currently do not have plans for supporting this feature. Curious about what your use-case is, can you tell us a bit more about your scenario?

Thanks!

@vit-svoboda
Copy link
Collaborator Author

Hi,
building off the example in the readme, if I had a hierarchical partition key setup like so

var subpartitionKeyPaths = new List<string> { "/TenantId", "/UserId", "/TransactionId" };

Then the following code should allow me to dump all of the tenant's data once they e.g. want their data deleted.

var firstLevelParititonKey  = new PartitionKeyBuilder()
    .Add(tenantId)
    .Build();
await container.DeleteAllItemsByPartitionKeyStreamAsync(firstLevelParititonKey);

Iterating over each transaction of each user of that particular tenant to provide the full 3-part partition keys doesn't seem practical.

Does the use-case make sense?

@tskimmett
Copy link

I'd just like to second this as a feature that would be great to have.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants