Skip to content

[CosmosDB] nested index query working through portal doesn't work via sdk #11721

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

Metadata

Labels

ClientThis issue points to a problem in the data-plane of the library.CosmosService AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions