Vincent Chalmel
Vincent Chalmel

Reputation: 652

How to set Rest request Headers parameters in pydocumentdb

I'm using the pydocumentdb library to query document-db.

I get errors when trying to execute cross-partitions queries, which are... considering I use a primary key as partition-key... every query I do.

The error message mentions the parameter x-ms-documentdb-query-enablecrosspartition. Which is indeed a rest http header constant, but I don't find any way to add parameters to the headers neither in the document_client module.

Upvotes: 0

Views: 99

Answers (1)

Vincent Chalmel
Vincent Chalmel

Reputation: 652

Finally found it :

client_documentDB = document_client.DocumentClient(
    config['ENDPOINT'], 
    {
        'masterKey': config['MASTERKEY']
    }
)
client_documentDB.default_headers['x-ms-documentdb-query-enablecrosspartition'] = True

Upvotes: 1

Related Questions