-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[CosmosDB] Query fails when setting partition_key #13519
Comments
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @wmengmsft, @MehaKaushik, @shurd, @anfeldma-ms |
@Rodrigossz Can you look into this? May be an issue with the samples for how to do query |
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @zfoster, @southpolesteve. |
Hello @chrisyeh96 Tks for the feedback. We will check it out. As a workaround you can use 'select children from Families'. BTW, you sample code has 'testcontainer' instead of Families, but I think that it's a copy/paste error. Tks for the contribution! |
Hello @chrisyeh96 I'm closing this issue because it's a documentation problem, what I will start to address today. Basically what is happening is that your are narrowing down the scope with the FROM clause: instead of Families, and all of it's properties, your "dataset" only has the children property. And the partition key isn't there. Tks for the help to improve the product. |
@Rodrigossz Thanks for looking into this issue. However, I'm not convinced that narrowing down the scope in the Plus, the queries work just fine in Data Explorer on the Azure web portal. This is clearly an issue with the Python SDK, not with my query. |
Data Explorer uses another SDK behind the interface and has different environment settings. As an example, it runs all queries as cross partition enabled. So you can expect absolutely different behavior between any SDK and Data Explorer. When you use If you try the same in the Data Explorer you will get:
Please note that for
The SDK will transform into SELECT * FROM Families.children where Families.children.id = 'AndersenFamily' , what doesn't work. I am adding clarifications on that to the Python SDK README file. |
Describe the bug
I created a test CosmosDB database using the Azure web portal with the examples from the CosmosDB Getting Started documentation.
I set the
partition_key
on the container to be the"id"
field. I can run the following queries (from the SQL Query Object Array page) via the "Data Explorer" on the Azure web portal just fine, but the Python SDK has issues when I setpartition_key
on the query.The following two queries work fine in Data Explorer on the Azure web portal:
Both queries throw errors in the Python SDK when I pass a
partition_key
parameter toquery_items()
:Expected behavior
Setting
partition_key
onquery_items()
should not cause an error.Additional context
I suspect that this may be related to the bug reported in #11721. However, my example here is much simpler and identifies the issue with passing a
partition_key
argument toquery_items()
.The text was updated successfully, but these errors were encountered: