Skip to content

Sample Update TTL doesnt work (comes back with cna't change partition key) #15683

@bekraupov

Description

@bekraupov
  • Package Name: azure-cosmos
  • Package Version: 4.2.0
  • Operating System: Windows
  • Python Version: 3.6

Describe the bug
I am trying to run sample command described in pypi to update TTL of the container

To Reproduce
Steps to reproduce the behavior:
database.replace_container(
container,
partition_key=PartitionKey(path="/productName"),
default_ttl=10,
)

Expected behavior
It should udpate the TTL but in my case it is giving an error as per below:
azure.cosmos.exceptions.CosmosHttpResponseError: (BadRequest) Message: {"serializedCollection":"{"Errors":["Document collection partition key cannot be changed."]}","serializedSourceCollectionForMaterializedView":"","serializedOffer":"","serializedPartitionKeyRanges":[],"serializedPartitions":[],"collectionRemoteStorageSecurityIdentifier":"00000000-0000-0000-c014-e146cc010000","collectionChildResourceNameLimitInBytes":-1,"collectionChildResourceContentLengthLimitInKB":-1,"uniqueIndexNameEncodingMode":0,"uniqueIndexReIndexingState":0}
ActivityId: 0fb27df8-444a-4892-9655-1cab99e03c3b, Request URI: /apps/29ee1020-5171-4c4e-8bb0-26e77ead2474/services/8bc5e8f8-9062-49f8-808a-e8093b414a15/partitions/dc35cf73-721c-483b-9246-2cb73cddd2f6/replicas/132500272630426623p, RequestStats:
RequestStartTime: 2020-12-07T15:19:50.3866416Z, RequestEndTime: 2020-12-07T15:19:50.3866416Z, Number of regions attempted:1
ResponseTime: 2020-12-07T15:19:50.3866416Z, StoreResult: StorePhysicalAddress: rntbd://10.0.0.31:11300/apps/29ee1020-5171-4c4e-8bb0-26e77ead2474/services/8bc5e8f8-9062-49f8-808a-e8093b414a15/partitions/dc35cf73-721c-483b-9246-2cb73cddd2f6/replicas/132500272630426623p, LSN: 3121, GlobalCommittedLsn: 3121, PartitionKeyRangeId: , IsValid: True, StatusCode: 400, SubStatusCode: 0, RequestCharge: 1.24, ItemLSN: -1, SessionToken: -1#3121, UsingLocalLSN: False, TransportException: null, ResourceType: Collection, OperationType: Replace
, SDK: Microsoft.Azure.Documents.Common/2.11.0

Tried on my collegue's box as well so he is having similar issue. We tried to retrieve Parition Key from container and use the same (not hardcode), same issue

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

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