Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: CosmosDB State Store Query to support partitioned queries #3244

Open
DSpirit opened this issue Nov 20, 2023 · 6 comments
Open
Labels
Milestone

Comments

@DSpirit
Copy link

DSpirit commented Nov 20, 2023

Describe the feature

When saving data through the DaprClient using the partitionKey metadata, everything is stored fine and is partitioned correctly.
When querying data using the DaprClient with a partitionKey metadata Dictionary, It would be great if only the records having the specified partitionKey are returned.

Here's an example setup (and also some screenshots): https://github.com/DSpirit/dapr-cosmosdb-partitioning

Maintainer Edit:

This is not a bug but intended behavior. The description above needs updating so it is clear that this is a feature enhancement request to add support for partitioned queries. Today the CosmosDB State Store Query API implementation intentionally performs cross-partition queries exclusively.

Release Note

RELEASE NOTE: ADD Support for partition queries in CosmosDB StateStore

@DSpirit DSpirit added the kind/bug Something isn't working label Nov 20, 2023
@berndverst
Copy link
Member

berndverst commented Nov 21, 2023

We use cross-partition queries in our Query API implementation. This is expected behavior. Also note that Query API is Alpha and will not be made stable.

Why are we using cross-partition queries? Because the default value assigned to /partitionKey is the state store key. That means every single entity would have a different partition key value which makes querying impossible.

Dapr's Query API is not a replacement for a CosmosDB SDK to query entities. I also strongly discourage use of the Dapr Query API.

@berndverst
Copy link
Member

berndverst commented Nov 21, 2023

One possibility we could consider: If the partition key is provided as metadata on the query request, we could perform a regular partitioned query. This however would be a feature request.

If so, can you please update your issue title and description @DSpirit to turn this into a feature request?

@berndverst
Copy link
Member

I think @luigirende would be interested in implementing this.

@berndverst berndverst changed the title CosmosDB State Store Query doesn't respect P Feature Request: CosmosDB State Store Query to support partitioned queries Nov 21, 2023
@berndverst berndverst added kind/enhancement New feature or request and removed kind/bug Something isn't working working as intended labels Nov 21, 2023
@DSpirit
Copy link
Author

DSpirit commented Nov 22, 2023

@berndverst thank you for the update! As we currently use the CosmosDB SDK anyway, it would just be a nice-to-have - so feel free to add it if you have the time :)

@luigirende
Copy link
Contributor

@DSpirit created a PR 3227 for this change

@DSpirit
Copy link
Author

DSpirit commented Nov 26, 2023

@luigirende wow that was quick! Many thanks :) Looking forward to it!

@berndverst berndverst added this to the v1.13 milestone Dec 7, 2023
@ItalyPaleAle ItalyPaleAle modified the milestones: v1.13, v1.14 Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants