Message: Cross partition query is required but disabled. Please set x-ms-documentdb-query-enablecrosspartition to true, specify x-ms-documentdb-partitionkey, or revise your query to avoid this exception.

Gerard Church 1 Reputation point
2021-11-05T11:30:12.587+00:00

I have a Azure Cosmos DB container in Azure partitioned by 'ticker'. I am using the python SDK to try and make a simply query using the ContainerProxy I receive the following error:

for item in container.query_items('SELECT * FROM scores', enable_cross_partition_query=True):
print(item)

Message: Cross partition query is required but disabled. Please set x-ms-documentdb-query-enablecrosspartition to true, specify x-ms-documentdb-partitionkey, or revise your query to avoid this exception.

Being a new user to the Cosmos DB, I don't really understand what this means or where to set this parameter and was hoping someone could help me out.

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,678 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.