Closed
Description
- Package Name: azure-cosmos
- Package Version: 4.0.0
- Operating System: Ubuntu 20.04
- Python Version: 3.8.2
Describe the bug
Queries of the format described here (e.g. SELECT location FROM location IN company.locations WHERE location.country = 'France'
) do not work using the sdk.
To Reproduce
CHAT_CONFIG = {
"id": "chat",
"partition_key": azure.cosmos.PartitionKey("/id", version=1),
"indexing_policy": {
"indexingMode": "consistent",
"excludedPaths": [{"path": "/*"}],
"includedPaths": [{"path": "/moderators/user_id/?"}],
},
}
container.query_items(
f"select * from mod in chat.moderators where mod.user_id = '{user_id}'",
partition_key=chat_id,
)
The above produces the following exception: azure.cosmos.exceptions.CosmosHttpResponseError: (BadRequest) Message: {"errors":[{"severity":"Error","location":{"start":4294967295,"end":4294967295},"code":"SC2001","message":"Identifier 'chat' could not be resolved."}]}
. Here is a sample document:
{
"id": "chat",
"creator": "creator",
"owner": "owner",
"created": 1590606509648,
"moderators": [
{
"user_id": "owner",
"since": 1590606509648
}
]
}
Expected behavior
Running this query from the azure portal works as expected and should work from the sdk.
I already raised this issue on the doc page here but am reposting it here since it may be sdk specific. Thanks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment