Trying to make an aggregated query in Azure Cosmos DB:
SELECT COUNT(1) AS x, c.a, c.b
FROM c
GROUP BY c.a, c.b
This query resolves in Cosmos Data Explorer. However, using Cosmos Python SDK:
qry_res = list(container_client.query_items(query=query, enable_cross_partition_query=True))
gives the following error:
"Cross partition query only supports 'VALUE <AggregateFunc>' for aggregates."
Adding VALUE to the query didn't resolve the issue:
SELECT VALUE COUNT(1) AS x, c.a, c.b
FROM c
GROUP BY c.a, c.b
gives "Syntax error, incorrect syntax near 'AS'." error.
Why is the SDK inconsistent with Data Explorer? It's really confusing!