Fix: Allow tuples to be used for hierarchical partition key values.#38136
Fix: Allow tuples to be used for hierarchical partition key values.#38136bambriz merged 15 commits intoAzure:mainfrom
Conversation
Allows the usage of tuples alongside lists to be used for hierarchical partition key values. Both get serialized to json arrays. Previous behaviour would give an error that a prefix query was attempted which is incorrect behaviour.
|
/azp run python - cosmos - tests |
|
/azp run python - cosmos - tests |
kushagraThapar
left a comment
There was a problem hiding this comment.
I am curious, why tests are not running on this PR?
Blocking because of testing. @scbedd did we change anything?
|
@bambriz can you please re-run the CI before merging this PR. |
kushagraThapar
left a comment
There was a problem hiding this comment.
Curious about couple of things.
|
/azp run python - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run python - cosmos - ci |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
API change check API changes are not detected in this pull request. |
optimization
|
/azp run python - cosmos - ci |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run python - cosmos - ci |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run python - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Changes the type hint of partition key to be sequence instead of explicitly tuple and list.
|
/azp run python - cosmos - ci |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run python - cosmos - tests |
|
Pull request contains merge conflicts. |
|
/azp run python - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run python - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run python - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run python - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run python - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run python - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
update version to 4.8.0
…zure#38136) * Fix support for allowing tuples to be used for subapartition Allows the usage of tuples alongside lists to be used for hierarchical partition key values. Both get serialized to json arrays. Previous behaviour would give an error that a prefix query was attempted which is incorrect behaviour. * update docstrings * Update CHANGELOG.md * Update partition_key.py * Update partition_key.py optimization * Update partition_key.py * Update partition_key.py * Update partition_key.py * Update type hint of partition key Changes the type hint of partition key to be sequence instead of explicitly tuple and list. * update version update version to 4.8.0
Description
This PR fixes an issue where passing in a tuple will cause the following error to be thrown: ValueError: 2 partition key components provided. Expected less than 2 components (number of container partition key definition components).
Which should only occur when doing a prefix partition query. This pr allows passing in tuples and not just lists for subpartitioning. Both tuples and lists are serialized to json arrays and json arrays are ultimately deserialized to lists by default. This also updates type hinting to show tuples can be used the same as lists for pk values.
This pr fixes: Issue 37638