Reputation: 11
When I run a query like this in the portal, it runs just fine. But when I run it from the python SDK, I get “Cross partition query only supports 'VALUE ' for aggregates.". I want to run it across all partitions. Any suggestion on how to get it working from the SDK?
Thanks, Peter
SELECT c.data.video.id, COUNT(1) as nTraces, MAX(c.data.time) as lastReport FROM c WHERE c.data.time > "2020-06-02T17:40:25.593141+00:00" GROUP BY c.data.video.id
Upvotes: 1
Views: 1214
Reputation: 8690
According to my test,python sdk don't support group by
.
Below is my test code:
query = "SELECT c.id FROM c group by c.id"
items = list(container.query_items(
query=query,
enable_cross_partition_query=True
))
Here is the error:
azure.cosmos.exceptions.CosmosHttpResponseError: (BadRequest) Gateway Failed to Retrieve Query Plan: Query contains 1 or more unsupported features. Upgrade your SDK to a version that does support the requested features:
Query contained GroupBy, which the calling client does not support.
Refer to this document,.net sdk and js sdk support group by
.
So you can do this by using .net sdk and js sdk.
By the way,I search for the python sdk release history and it doesn't mentioned supporting group by
.
Hope this can help you.
Upvotes: 2