diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/_base.py b/sdk/cosmos/azure-cosmos/azure/cosmos/_base.py
index b0945cdd415d..f8ab0ca15961 100644
--- a/sdk/cosmos/azure-cosmos/azure/cosmos/_base.py
+++ b/sdk/cosmos/azure-cosmos/azure/cosmos/_base.py
@@ -60,7 +60,7 @@
'is_query_plan_request': 'isQueryPlanRequest',
'supported_query_features': 'supportedQueryFeatures',
'query_version': 'queryVersion',
- 'priority_level': 'priorityLevel'
+ 'priority': 'priorityLevel'
}
# Cosmos resource ID validation regex breakdown:
@@ -245,7 +245,7 @@ def GetHeaders( # pylint: disable=too-many-statements,too-many-branches
headers[http_constants.HttpHeaders.ResponseContinuationTokenLimitInKb] = options[
"responseContinuationTokenLimitInKb"]
- if options.get("priorityLevel") and options["priorityLevel"].lower() in {"low", "high"}:
+ if options.get("priorityLevel"):
headers[http_constants.HttpHeaders.PriorityLevel] = options["priorityLevel"]
if cosmos_client_connection.master_key:
diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_integers.py b/sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_integers.py
index ead67ba5559e..ae219197e819 100644
--- a/sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_integers.py
+++ b/sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_integers.py
@@ -22,7 +22,7 @@
from typing import NoReturn, Tuple, Union
-class UInt64:
+class _UInt64:
def __init__(self, value: int) -> None:
self._value: int = value & 0xFFFFFFFFFFFFFFFF
@@ -34,43 +34,43 @@ def value(self) -> int:
def value(self, new_value: int) -> None:
self._value = new_value & 0xFFFFFFFFFFFFFFFF
- def __add__(self, other: Union[int, 'UInt64']) -> 'UInt64':
- result = self.value + (other.value if isinstance(other, UInt64) else other)
- return UInt64(result & 0xFFFFFFFFFFFFFFFF)
+ def __add__(self, other: Union[int, '_UInt64']) -> '_UInt64':
+ result = self.value + (other.value if isinstance(other, _UInt64) else other)
+ return _UInt64(result & 0xFFFFFFFFFFFFFFFF)
- def __sub__(self, other: Union[int, 'UInt64']) -> 'UInt64':
- result = self.value - (other.value if isinstance(other, UInt64) else other)
- return UInt64(result & 0xFFFFFFFFFFFFFFFF)
+ def __sub__(self, other: Union[int, '_UInt64']) -> '_UInt64':
+ result = self.value - (other.value if isinstance(other, _UInt64) else other)
+ return _UInt64(result & 0xFFFFFFFFFFFFFFFF)
- def __mul__(self, other: Union[int, 'UInt64']) -> 'UInt64':
- result = self.value * (other.value if isinstance(other, UInt64) else other)
- return UInt64(result & 0xFFFFFFFFFFFFFFFF)
+ def __mul__(self, other: Union[int, '_UInt64']) -> '_UInt64':
+ result = self.value * (other.value if isinstance(other, _UInt64) else other)
+ return _UInt64(result & 0xFFFFFFFFFFFFFFFF)
- def __xor__(self, other: Union[int, 'UInt64']) -> 'UInt64':
- result = self.value ^ (other.value if isinstance(other, UInt64) else other)
- return UInt64(result & 0xFFFFFFFFFFFFFFFF)
+ def __xor__(self, other: Union[int, '_UInt64']) -> '_UInt64':
+ result = self.value ^ (other.value if isinstance(other, _UInt64) else other)
+ return _UInt64(result & 0xFFFFFFFFFFFFFFFF)
- def __lshift__(self, other: Union[int, 'UInt64']) -> 'UInt64':
- result = self.value << (other.value if isinstance(other, UInt64) else other)
- return UInt64(result & 0xFFFFFFFFFFFFFFFF)
+ def __lshift__(self, other: Union[int, '_UInt64']) -> '_UInt64':
+ result = self.value << (other.value if isinstance(other, _UInt64) else other)
+ return _UInt64(result & 0xFFFFFFFFFFFFFFFF)
- def __rshift__(self, other: Union[int, 'UInt64']) -> 'UInt64':
- result = self.value >> (other.value if isinstance(other, UInt64) else other)
- return UInt64(result & 0xFFFFFFFFFFFFFFFF)
+ def __rshift__(self, other: Union[int, '_UInt64']) -> '_UInt64':
+ result = self.value >> (other.value if isinstance(other, _UInt64) else other)
+ return _UInt64(result & 0xFFFFFFFFFFFFFFFF)
- def __and__(self, other: Union[int, 'UInt64']) -> 'UInt64':
- result = self.value & (other.value if isinstance(other, UInt64) else other)
- return UInt64(result & 0xFFFFFFFFFFFFFFFF)
+ def __and__(self, other: Union[int, '_UInt64']) -> '_UInt64':
+ result = self.value & (other.value if isinstance(other, _UInt64) else other)
+ return _UInt64(result & 0xFFFFFFFFFFFFFFFF)
- def __or__(self, other: Union[int, 'UInt64']) -> 'UInt64':
- if isinstance(other, UInt64):
- return UInt64(self.value | other.value)
+ def __or__(self, other: Union[int, '_UInt64']) -> '_UInt64':
+ if isinstance(other, _UInt64):
+ return _UInt64(self.value | other.value)
if isinstance(other, int):
- return UInt64(self.value | other)
+ return _UInt64(self.value | other)
raise TypeError("Unsupported type for OR operation")
- def __invert__(self) -> 'UInt64':
- return UInt64(~self.value & 0xFFFFFFFFFFFFFFFF)
+ def __invert__(self) -> '_UInt64':
+ return _UInt64(~self.value & 0xFFFFFFFFFFFFFFFF)
@staticmethod
def encode_double_as_uint64(value: float) -> int:
@@ -88,62 +88,62 @@ def __int__(self) -> int:
return self.value
-class UInt128:
- def __init__(self, low: Union[int, UInt64], high: Union[int, UInt64]) -> None:
- if isinstance(low, UInt64):
+class _UInt128:
+ def __init__(self, low: Union[int, _UInt64], high: Union[int, _UInt64]) -> None:
+ if isinstance(low, _UInt64):
self.low = low
else:
- self.low = UInt64(low)
- if isinstance(high, UInt64):
+ self.low = _UInt64(low)
+ if isinstance(high, _UInt64):
self.high = high
else:
- self.high = UInt64(high)
+ self.high = _UInt64(high)
- def __add__(self, other: 'UInt128') -> 'UInt128':
+ def __add__(self, other: '_UInt128') -> '_UInt128':
low = self.low + other.low
- high = self.high + other.high + UInt64(int(low.value > 0xFFFFFFFFFFFFFFFF))
- return UInt128(low & 0xFFFFFFFFFFFFFFFF, high & 0xFFFFFFFFFFFFFFFF)
+ high = self.high + other.high + _UInt64(int(low.value > 0xFFFFFFFFFFFFFFFF))
+ return _UInt128(low & 0xFFFFFFFFFFFFFFFF, high & 0xFFFFFFFFFFFFFFFF)
- def __sub__(self, other: 'UInt128') -> 'UInt128':
- borrow = UInt64(0)
+ def __sub__(self, other: '_UInt128') -> '_UInt128':
+ borrow = _UInt64(0)
if self.low.value < other.low.value:
- borrow = UInt64(1)
+ borrow = _UInt64(1)
low = (self.low - other.low) & 0xFFFFFFFFFFFFFFFF
high = (self.high - other.high - borrow) & 0xFFFFFFFFFFFFFFFF
- return UInt128(low, high)
+ return _UInt128(low, high)
- def __mul__(self, other: 'UInt128') -> NoReturn:
+ def __mul__(self, other: '_UInt128') -> NoReturn:
# Multiplication logic here for 128 bits
raise NotImplementedError()
- def __xor__(self, other: 'UInt128') -> 'UInt128':
+ def __xor__(self, other: '_UInt128') -> '_UInt128':
low = self.low ^ other.low
high = self.high ^ other.high
- return UInt128(low, high)
+ return _UInt128(low, high)
- def __and__(self, other: 'UInt128') -> 'UInt128':
+ def __and__(self, other: '_UInt128') -> '_UInt128':
low = self.low & other.low
high = self.high & other.high
- return UInt128(low, high)
+ return _UInt128(low, high)
- def __or__(self, other: 'UInt128') -> 'UInt128':
+ def __or__(self, other: '_UInt128') -> '_UInt128':
low = self.low | other.low
high = self.high | other.high
- return UInt128(low, high)
+ return _UInt128(low, high)
- def __lshift__(self, shift: 'UInt128') -> NoReturn:
+ def __lshift__(self, shift: '_UInt128') -> NoReturn:
# Left shift logic for 128 bits
raise NotImplementedError()
- def __rshift__(self, shift: 'UInt128') -> NoReturn:
+ def __rshift__(self, shift: '_UInt128') -> NoReturn:
# Right shift logic for 128 bits
raise NotImplementedError()
- def get_low(self) -> UInt64:
+ def get_low(self) -> _UInt64:
return self.low
- def get_high(self) -> UInt64:
+ def get_high(self) -> _UInt64:
return self.high
def as_tuple(self) -> Tuple[int, int]:
diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_murmurhash3.py b/sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_murmurhash3.py
index 2cfeaf2ff121..9d1a6af528e7 100644
--- a/sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_murmurhash3.py
+++ b/sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_murmurhash3.py
@@ -30,14 +30,14 @@
# This is public domain code with no copyrights. From home page of
# SMHasher:
# "All MurmurHash versions are public domain software, and the author disclaims all copyright to their code."
-from ._cosmos_integers import UInt128, UInt64
+from ._cosmos_integers import _UInt128, _UInt64
def rotate_left_64(val: int, shift: int) -> int:
return (val << shift) | (val >> (64 - shift))
-def mix(value: UInt64) -> UInt64:
+def mix(value: _UInt64) -> _UInt64:
value ^= value >> 33
value *= 0xff51afd7ed558ccd
value = value & 0xFFFFFFFFFFFFFFFF
@@ -48,7 +48,7 @@ def mix(value: UInt64) -> UInt64:
return value
-def murmurhash3_128(span: bytearray, seed: UInt128) -> UInt128: # pylint: disable=too-many-statements
+def murmurhash3_128(span: bytearray, seed: _UInt128) -> _UInt128: # pylint: disable=too-many-statements
"""
Python implementation of 128 bit murmurhash3 from Dot Net SDK. To match with other SDKs, It is recommended to
do the following with number values, especially floats as other SDKs use Doubles
@@ -56,22 +56,22 @@ def murmurhash3_128(span: bytearray, seed: UInt128) -> UInt128: # pylint: disab
:param bytearray span:
bytearray of value to hash
- :param UInt128 seed:
+ :param _UInt128 seed:
seed value for murmurhash3, takes in a UInt128 value from Cosmos Integers
:return:
The hash value as a UInt128
:rtype:
UInt128
"""
- c1 = UInt64(0x87c37b91114253d5)
- c2 = UInt64(0x4cf5ad432745937f)
+ c1 = _UInt64(0x87c37b91114253d5)
+ c2 = _UInt64(0x4cf5ad432745937f)
h1 = seed.get_low()
h2 = seed.get_high()
position = 0
while position < len(span) - 15:
- k1 = UInt64(int.from_bytes(span[position: position + 8], 'little'))
- k2 = UInt64(int.from_bytes(span[position + 8: position + 16], 'little'))
+ k1 = _UInt64(int.from_bytes(span[position: position + 8], 'little'))
+ k2 = _UInt64(int.from_bytes(span[position + 8: position + 16], 'little'))
k1 *= c1
k1.value = rotate_left_64(k1.value, 31)
@@ -79,7 +79,7 @@ def murmurhash3_128(span: bytearray, seed: UInt128) -> UInt128: # pylint: disab
h1 ^= k1
h1.value = rotate_left_64(h1.value, 27)
h1 += h2
- h1 = h1 * 5 + UInt64(0x52dce729)
+ h1 = h1 * 5 + _UInt64(0x52dce729)
k2 *= c2
k2.value = rotate_left_64(k2.value, 33)
@@ -87,27 +87,27 @@ def murmurhash3_128(span: bytearray, seed: UInt128) -> UInt128: # pylint: disab
h2 ^= k2
h2.value = rotate_left_64(h2.value, 31)
h2 += h1
- h2 = h2 * 5 + UInt64(0x38495ab5)
+ h2 = h2 * 5 + _UInt64(0x38495ab5)
position += 16
- k1 = UInt64(0)
- k2 = UInt64(0)
+ k1 = _UInt64(0)
+ k2 = _UInt64(0)
n = len(span) & 15
if n >= 15:
- k2 ^= UInt64(span[position + 14] << 48)
+ k2 ^= _UInt64(span[position + 14] << 48)
if n >= 14:
- k2 ^= UInt64(span[position + 13] << 40)
+ k2 ^= _UInt64(span[position + 13] << 40)
if n >= 13:
- k2 ^= UInt64(span[position + 12] << 32)
+ k2 ^= _UInt64(span[position + 12] << 32)
if n >= 12:
- k2 ^= UInt64(span[position + 11] << 24)
+ k2 ^= _UInt64(span[position + 11] << 24)
if n >= 11:
- k2 ^= UInt64(span[position + 10] << 16)
+ k2 ^= _UInt64(span[position + 10] << 16)
if n >= 10:
- k2 ^= UInt64(span[position + 9] << 8)
+ k2 ^= _UInt64(span[position + 9] << 8)
if n >= 9:
- k2 ^= UInt64(span[position + 8] << 0)
+ k2 ^= _UInt64(span[position + 8] << 0)
k2 *= c2
k2.value = rotate_left_64(k2.value, 33)
@@ -115,21 +115,21 @@ def murmurhash3_128(span: bytearray, seed: UInt128) -> UInt128: # pylint: disab
h2 ^= k2
if n >= 8:
- k1 ^= UInt64(span[position + 7] << 56)
+ k1 ^= _UInt64(span[position + 7] << 56)
if n >= 7:
- k1 ^= UInt64(span[position + 6] << 48)
+ k1 ^= _UInt64(span[position + 6] << 48)
if n >= 6:
- k1 ^= UInt64(span[position + 5] << 40)
+ k1 ^= _UInt64(span[position + 5] << 40)
if n >= 5:
- k1 ^= UInt64(span[position + 4] << 32)
+ k1 ^= _UInt64(span[position + 4] << 32)
if n >= 4:
- k1 ^= UInt64(span[position + 3] << 24)
+ k1 ^= _UInt64(span[position + 3] << 24)
if n >= 3:
- k1 ^= UInt64(span[position + 2] << 16)
+ k1 ^= _UInt64(span[position + 2] << 16)
if n >= 2:
- k1 ^= UInt64(span[position + 1] << 8)
+ k1 ^= _UInt64(span[position + 1] << 8)
if n >= 1:
- k1 ^= UInt64(span[position + 0] << 0)
+ k1 ^= _UInt64(span[position + 0] << 0)
k1 *= c1
k1.value = rotate_left_64(k1.value, 31)
@@ -137,8 +137,8 @@ def murmurhash3_128(span: bytearray, seed: UInt128) -> UInt128: # pylint: disab
h1 ^= k1
# Finalization
- h1 ^= UInt64(len(span))
- h2 ^= UInt64(len(span))
+ h1 ^= _UInt64(len(span))
+ h2 ^= _UInt64(len(span))
h1 += h2
h2 += h1
h1 = mix(h1)
@@ -146,4 +146,4 @@ def murmurhash3_128(span: bytearray, seed: UInt128) -> UInt128: # pylint: disab
h1 += h2
h2 += h1
- return UInt128(int(h1.value), int(h2.value))
+ return _UInt128(int(h1.value), int(h2.value))
diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/aio/_container.py b/sdk/cosmos/azure-cosmos/azure/cosmos/aio/_container.py
index 5fcd9e0d6ffc..cf7197ef1f32 100644
--- a/sdk/cosmos/azure-cosmos/azure/cosmos/aio/_container.py
+++ b/sdk/cosmos/azure-cosmos/azure/cosmos/aio/_container.py
@@ -135,7 +135,7 @@ async def read(
populate_partition_key_range_statistics: Optional[bool] = None,
populate_quota_info: Optional[bool] = None,
session_token: Optional[str] = None,
- priority_level: Optional[Literal["High", "Low"]] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
initial_headers: Optional[Dict[str, str]] = None,
**kwargs: Any
) -> Dict[str, Any]:
@@ -148,7 +148,7 @@ async def read(
:keyword dict[str, str] initial_headers: Initial headers to be sent as part of the request.
:keyword response_hook: A callable invoked with the response metadata.
:paramtype response_hook: Callable[[Dict[str, str], Dict[str, Any]], None]
- :keyword Literal["High", "Low"] priority_level: Priority based execution allows users to set a priority for each
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
request. Once the user has reached their provisioned throughput, low priority requests are throttled
before high priority requests start getting throttled. Feature must first be enabled at the account level.
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: Raised if the container couldn't be retrieved.
@@ -158,8 +158,8 @@ async def read(
"""
if session_token is not None:
kwargs['session_token'] = session_token
- if priority_level is not None:
- kwargs['priority_level'] = priority_level
+ if priority is not None:
+ kwargs['priority'] = priority
if initial_headers is not None:
kwargs['initial_headers'] = initial_headers
request_options = _build_options(kwargs)
@@ -187,7 +187,7 @@ async def create_item(
initial_headers: Optional[Dict[str, str]] = None,
etag: Optional[str] = None,
match_condition: Optional[MatchConditions] = None,
- priority_level: Optional[Literal["High", "Low"]] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
**kwargs: Any
) -> Dict[str, Any]:
"""Create an item in the container.
@@ -210,7 +210,7 @@ async def create_item(
:paramtype match_condition: ~azure.core.MatchConditions
:keyword response_hook: A callable invoked with the response metadata.
:paramtype response_hook: Callable[[Dict[str, str], Dict[str, Any]], None]
- :keyword Literal["High", "Low"] priority_level: Priority based execution allows users to set a priority for each
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
request. Once the user has reached their provisioned throughput, low priority requests are throttled
before high priority requests start getting throttled. Feature must first be enabled at the account level.
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: Item with the given ID already exists.
@@ -225,8 +225,8 @@ async def create_item(
kwargs['session_token'] = session_token
if initial_headers is not None:
kwargs['initial_headers'] = initial_headers
- if priority_level is not None:
- kwargs['priority_level'] = priority_level
+ if priority is not None:
+ kwargs['priority'] = priority
if etag is not None:
kwargs['etag'] = etag
if match_condition is not None:
@@ -251,7 +251,7 @@ async def read_item(
session_token: Optional[str] = None,
initial_headers: Optional[Dict[str, str]] = None,
max_integrated_cache_staleness_in_ms: Optional[int] = None,
- priority_level: Optional[Literal["High", "Low"]] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
**kwargs: Any
) -> Dict[str, Any]:
"""Get the item identified by `item`.
@@ -268,7 +268,7 @@ async def read_item(
:keyword int max_integrated_cache_staleness_in_ms: The max cache staleness for the integrated cache in
milliseconds. For accounts configured to use the integrated cache, using Session or Eventual consistency,
responses are guaranteed to be no staler than this value.
- :keyword Literal["High", "Low"] priority_level: Priority based execution allows users to set a priority for each
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
request. Once the user has reached their provisioned throughput, low priority requests are throttled
before high priority requests start getting throttled. Feature must first be enabled at the account level.
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: The given item couldn't be retrieved.
@@ -292,8 +292,8 @@ async def read_item(
kwargs['session_token'] = session_token
if initial_headers is not None:
kwargs['initial_headers'] = initial_headers
- if priority_level is not None:
- kwargs['priority_level'] = priority_level
+ if priority is not None:
+ kwargs['priority'] = priority
request_options = _build_options(kwargs)
request_options["partitionKey"] = await self._set_partition_key(partition_key)
@@ -311,7 +311,7 @@ def read_all_items(
session_token: Optional[str] = None,
initial_headers: Optional[Dict[str, str]] = None,
max_integrated_cache_staleness_in_ms: Optional[int] = None,
- priority_level: Optional[Literal["High", "Low"]] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
**kwargs: Any
) -> AsyncItemPaged[Dict[str, Any]]:
"""List all the items in the container.
@@ -324,7 +324,7 @@ def read_all_items(
:keyword int max_integrated_cache_staleness_in_ms: The max cache staleness for the integrated cache in
milliseconds. For accounts configured to use the integrated cache, using Session or Eventual consistency,
responses are guaranteed to be no staler than this value.
- :keyword Literal["High", "Low"] priority_level: Priority based execution allows users to set a priority for each
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
request. Once the user has reached their provisioned throughput, low priority requests are throttled
before high priority requests start getting throttled. Feature must first be enabled at the account level.
:returns: An AsyncItemPaged of items (dicts).
@@ -335,8 +335,8 @@ def read_all_items(
kwargs['session_token'] = session_token
if initial_headers is not None:
kwargs['initial_headers'] = initial_headers
- if priority_level is not None:
- kwargs['priority_level'] = priority_level
+ if priority is not None:
+ kwargs['priority'] = priority
feed_options = _build_options(kwargs)
if max_item_count is not None:
feed_options["maxItemCount"] = max_item_count
@@ -367,7 +367,7 @@ def query_items(
session_token: Optional[str] = None,
initial_headers: Optional[Dict[str, str]] = None,
max_integrated_cache_staleness_in_ms: Optional[int] = None,
- priority_level: Optional[Literal["High", "Low"]] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
continuation_token_limit: Optional[int] = None,
**kwargs: Any
) -> AsyncItemPaged[Dict[str, Any]]:
@@ -403,7 +403,7 @@ def query_items(
:keyword int max_integrated_cache_staleness_in_ms: The max cache staleness for the integrated cache in
milliseconds. For accounts configured to use the integrated cache, using Session or Eventual consistency,
responses are guaranteed to be no staler than this value.
- :keyword Literal["High", "Low"] priority_level: Priority based execution allows users to set a priority for each
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
request. Once the user has reached their provisioned throughput, low priority requests are throttled
before high priority requests start getting throttled. Feature must first be enabled at the account level.
:returns: An AsyncItemPaged of items (dicts).
@@ -432,8 +432,8 @@ def query_items(
kwargs['session_token'] = session_token
if initial_headers is not None:
kwargs['initial_headers'] = initial_headers
- if priority_level is not None:
- kwargs['priority_level'] = priority_level
+ if priority is not None:
+ kwargs['priority'] = priority
feed_options = _build_options(kwargs)
if max_item_count is not None:
feed_options["maxItemCount"] = max_item_count
@@ -479,7 +479,7 @@ def query_items_change_feed(
continuation: Optional[str] = None,
max_item_count: Optional[int] = None,
partition_key: Optional[PartitionKeyType] = None,
- priority_level: Optional[Literal["High", "Low"]] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
**kwargs: Any
) -> AsyncItemPaged[Dict[str, Any]]:
"""Get a sorted list of items that were changed, in the order in which they were modified.
@@ -494,15 +494,15 @@ def query_items_change_feed(
:paramtype partition_key: Union[str, int, float, bool, List[Union[str, int, float, bool]]]
:keyword response_hook: A callable invoked with the response metadata.
:paramtype response_hook: Callable[[Dict[str, str], AsyncItemPaged[Dict[str, Any]]], None]
- :keyword Literal["High", "Low"] priority_level: Priority based execution allows users to set a priority for each
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
request. Once the user has reached their provisioned throughput, low priority requests are throttled
before high priority requests start getting throttled. Feature must first be enabled at the account level.
:returns: An AsyncItemPaged of items (dicts).
:rtype: AsyncItemPaged[Dict[str, Any]]
"""
response_hook = kwargs.pop('response_hook', None)
- if priority_level is not None:
- kwargs['priority_level'] = priority_level
+ if priority is not None:
+ kwargs['priority'] = priority
feed_options = _build_options(kwargs)
feed_options["isStartFromBeginning"] = is_start_from_beginning
if partition_key_range_id is not None:
@@ -534,7 +534,7 @@ async def upsert_item(
initial_headers: Optional[Dict[str, str]] = None,
etag: Optional[str] = None,
match_condition: Optional[MatchConditions] = None,
- priority_level: Optional[Literal["High", "Low"]] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
**kwargs: Any
) -> Dict[str, Any]:
"""Insert or update the specified item.
@@ -553,7 +553,7 @@ async def upsert_item(
:paramtype match_condition: ~azure.core.MatchConditions
:keyword response_hook: A callable invoked with the response metadata.
:paramtype response_hook: Callable[[Dict[str, str], Dict[str, Any]], None]
- :keyword Literal["High", "Low"] priority_level: Priority based execution allows users to set a priority for each
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
request. Once the user has reached their provisioned throughput, low priority requests are throttled
before high priority requests start getting throttled. Feature must first be enabled at the account level.
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: The given item could not be upserted.
@@ -568,8 +568,8 @@ async def upsert_item(
kwargs['session_token'] = session_token
if initial_headers is not None:
kwargs['initial_headers'] = initial_headers
- if priority_level is not None:
- kwargs['priority_level'] = priority_level
+ if priority is not None:
+ kwargs['priority'] = priority
if etag is not None:
kwargs['etag'] = etag
if match_condition is not None:
@@ -597,7 +597,7 @@ async def replace_item(
initial_headers: Optional[Dict[str, str]] = None,
etag: Optional[str] = None,
match_condition: Optional[MatchConditions] = None,
- priority_level: Optional[Literal["High", "Low"]] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
**kwargs: Any
) -> Dict[str, Any]:
"""Replaces the specified item if it exists in the container.
@@ -617,7 +617,7 @@ async def replace_item(
:paramtype match_condition: ~azure.core.MatchConditions
:keyword response_hook: A callable invoked with the response metadata.
:paramtype response_hook: Callable[[Dict[str, str], Dict[str, Any]], None]
- :keyword Literal["High", "Low"] priority_level: Priority based execution allows users to set a priority for each
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
request. Once the user has reached their provisioned throughput, low priority requests are throttled
before high priority requests start getting throttled. Feature must first be enabled at the account level.
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: The replace failed or the item with
@@ -634,8 +634,8 @@ async def replace_item(
kwargs['session_token'] = session_token
if initial_headers is not None:
kwargs['initial_headers'] = initial_headers
- if priority_level is not None:
- kwargs['priority_level'] = priority_level
+ if priority is not None:
+ kwargs['priority'] = priority
if etag is not None:
kwargs['etag'] = etag
if match_condition is not None:
@@ -661,7 +661,7 @@ async def patch_item(
session_token: Optional[str] = None,
etag: Optional[str] = None,
match_condition: Optional[MatchConditions] = None,
- priority_level: Optional[Literal["High", "Low"]] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
**kwargs: Any
) -> Dict[str, Any]:
""" Patches the specified item with the provided operations if it
@@ -683,7 +683,7 @@ async def patch_item(
has changed, and act according to the condition specified by the `match_condition` parameter.
:keyword ~azure.core.MatchConditions match_condition: The match condition to use upon the etag.
:keyword Callable response_hook: A callable invoked with the response metadata.
- :keyword Literal["High", "Low"] priority_level: Priority based execution allows users to set a priority for each
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
request. Once the user has reached their provisioned throughput, low priority requests are throttled
before high priority requests start getting throttled. Feature must first be enabled at the account level.
:returns: A dict representing the item after the patch operations went through.
@@ -697,8 +697,8 @@ async def patch_item(
kwargs['post_trigger_include'] = post_trigger_include
if session_token is not None:
kwargs['session_token'] = session_token
- if priority_level is not None:
- kwargs['priority_level'] = priority_level
+ if priority is not None:
+ kwargs['priority'] = priority
if etag is not None:
kwargs['etag'] = etag
if match_condition is not None:
@@ -725,6 +725,7 @@ async def delete_item(
initial_headers: Optional[Dict[str, str]] = None,
etag: Optional[str] = None,
match_condition: Optional[MatchConditions] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
**kwargs: Any
) -> None:
"""Delete the specified item from the container.
@@ -743,6 +744,9 @@ async def delete_item(
has changed, and act according to the condition specified by the `match_condition` parameter.
:keyword match_condition: The match condition to use upon the etag.
:paramtype match_condition: ~azure.core.MatchConditions
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
+ request. Once the user has reached their provisioned throughput, low priority requests are throttled
+ before high priority requests start getting throttled. Feature must first be enabled at the account level.
:keyword response_hook: A callable invoked with the response metadata.
:paramtype response_hook: Callable[[Dict[str, str], None], None]
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: The item wasn't deleted successfully.
@@ -761,6 +765,8 @@ async def delete_item(
kwargs['etag'] = etag
if match_condition is not None:
kwargs['match_condition'] = match_condition
+ if priority is not None:
+ kwargs['priority'] = priority
request_options = _build_options(kwargs)
request_options["partitionKey"] = await self._set_partition_key(partition_key)
@@ -1019,6 +1025,7 @@ async def execute_item_batch(
session_token: Optional[str] = None,
etag: Optional[str] = None,
match_condition: Optional[MatchConditions] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
**kwargs: Any
) -> List[Dict[str, Any]]:
""" Executes the transactional batch for the specified partition key.
@@ -1033,6 +1040,9 @@ async def execute_item_batch(
:keyword str etag: An ETag value, or the wildcard character (*). Used to check if the resource
has changed, and act according to the condition specified by the `match_condition` parameter.
:keyword ~azure.core.MatchConditions match_condition: The match condition to use upon the etag.
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
+ request. Once the user has reached their provisioned throughput, low priority requests are throttled
+ before high priority requests start getting throttled. Feature must first be enabled at the account level.
:keyword Callable response_hook: A callable invoked with the response metadata.
:returns: A list representing the items after the batch operations went through.
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: The batch failed to execute.
@@ -1049,6 +1059,8 @@ async def execute_item_batch(
kwargs['etag'] = etag
if match_condition is not None:
kwargs['match_condition'] = match_condition
+ if priority is not None:
+ kwargs['priority'] = priority
request_options = _build_options(kwargs)
request_options["partitionKey"] = await self._set_partition_key(partition_key)
request_options["disableAutomaticIdGeneration"] = True
diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/container.py b/sdk/cosmos/azure-cosmos/azure/cosmos/container.py
index da1c6e3ef6ce..35dedd32e164 100644
--- a/sdk/cosmos/azure-cosmos/azure/cosmos/container.py
+++ b/sdk/cosmos/azure-cosmos/azure/cosmos/container.py
@@ -136,7 +136,7 @@ def read( # pylint:disable=docstring-missing-param
populate_quota_info: Optional[bool] = None,
*,
session_token: Optional[str] = None,
- priority_level: Optional[Literal["High", "Low"]] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
initial_headers: Optional[Dict[str, str]] = None,
**kwargs: Any
) -> Dict[str, Any]:
@@ -147,7 +147,7 @@ def read( # pylint:disable=docstring-missing-param
:param bool populate_quota_info: Enable returning collection storage quota information in response headers.
:keyword str session_token: Token for use with Session consistency.
:keyword dict[str, str] initial_headers: Initial headers to be sent as part of the request.
- :keyword Literal["High", "Low"] priority_level: Priority based execution allows users to set a priority for each
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
request. Once the user has reached their provisioned throughput, low priority requests are throttled
before high priority requests start getting throttled. Feature must first be enabled at the account level.
:keyword dict[str, str] initial_headers: Initial headers to be sent as part of the request.
@@ -159,8 +159,8 @@ def read( # pylint:disable=docstring-missing-param
"""
if session_token is not None:
kwargs['session_token'] = session_token
- if priority_level is not None:
- kwargs['priority_level'] = priority_level
+ if priority is not None:
+ kwargs['priority'] = priority
if initial_headers is not None:
kwargs['initial_headers'] = initial_headers
request_options = build_options(kwargs)
@@ -190,7 +190,7 @@ def read_item( # pylint:disable=docstring-missing-param
session_token: Optional[str] = None,
initial_headers: Optional[Dict[str, str]] = None,
max_integrated_cache_staleness_in_ms: Optional[int] = None,
- priority_level: Optional[Literal["High", "Low"]] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
**kwargs: Any
) -> Dict[str, Any]:
"""Get the item identified by `item`.
@@ -206,7 +206,7 @@ def read_item( # pylint:disable=docstring-missing-param
:keyword int max_integrated_cache_staleness_in_ms: The max cache staleness for the integrated cache in
milliseconds. For accounts configured to use the integrated cache, using Session or Eventual consistency,
responses are guaranteed to be no staler than this value.
- :keyword Literal["High", "Low"] priority_level: Priority based execution allows users to set a priority for each
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
request. Once the user has reached their provisioned throughput, low priority requests are throttled
before high priority requests start getting throttled. Feature must first be enabled at the account level.
:returns: Dict representing the item to be retrieved.
@@ -227,8 +227,8 @@ def read_item( # pylint:disable=docstring-missing-param
kwargs['session_token'] = session_token
if initial_headers is not None:
kwargs['initial_headers'] = initial_headers
- if priority_level is not None:
- kwargs['priority_level'] = priority_level
+ if priority is not None:
+ kwargs['priority'] = priority
request_options = build_options(kwargs)
request_options["partitionKey"] = self._set_partition_key(partition_key)
@@ -255,7 +255,7 @@ def read_all_items( # pylint:disable=docstring-missing-param
session_token: Optional[str] = None,
initial_headers: Optional[Dict[str, str]] = None,
max_integrated_cache_staleness_in_ms: Optional[int] = None,
- priority_level: Optional[Literal["High", "Low"]] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
**kwargs: Any
) -> ItemPaged[Dict[str, Any]]:
"""List all the items in the container.
@@ -267,7 +267,7 @@ def read_all_items( # pylint:disable=docstring-missing-param
:keyword int max_integrated_cache_staleness_in_ms: The max cache staleness for the integrated cache in
milliseconds. For accounts configured to use the integrated cache, using Session or Eventual consistency,
responses are guaranteed to be no staler than this value.
- :keyword Literal["High", "Low"] priority_level: Priority based execution allows users to set a priority for each
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
request. Once the user has reached their provisioned throughput, low priority requests are throttled
before high priority requests start getting throttled. Feature must first be enabled at the account level.
:returns: An Iterable of items (dicts).
@@ -277,8 +277,8 @@ def read_all_items( # pylint:disable=docstring-missing-param
kwargs['session_token'] = session_token
if initial_headers is not None:
kwargs['initial_headers'] = initial_headers
- if priority_level is not None:
- kwargs['priority_level'] = priority_level
+ if priority is not None:
+ kwargs['priority'] = priority
feed_options = build_options(kwargs)
response_hook = kwargs.pop('response_hook', None)
if max_item_count is not None:
@@ -311,7 +311,7 @@ def query_items_change_feed(
max_item_count: Optional[int] = None,
*,
partition_key: Optional[PartitionKeyType] = None,
- priority_level: Optional[Literal["High", "Low"]] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
**kwargs: Any
) -> ItemPaged[Dict[str, Any]]:
"""Get a sorted list of items that were changed, in the order in which they were modified.
@@ -326,14 +326,14 @@ def query_items_change_feed(
:keyword partition_key: partition key at which ChangeFeed requests are targeted.
:paramtype partition_key: Union[str, int, float, bool, List[Union[str, int, float, bool]]]
:keyword Callable response_hook: A callable invoked with the response metadata.
- :keyword Literal["High", "Low"] priority_level: Priority based execution allows users to set a priority for each
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
request. Once the user has reached their provisioned throughput, low priority requests are throttled
before high priority requests start getting throttled. Feature must first be enabled at the account level.
:returns: An Iterable of items (dicts).
:rtype: Iterable[dict[str, Any]]
"""
- if priority_level is not None:
- kwargs['priority_level'] = priority_level
+ if priority is not None:
+ kwargs['priority'] = priority
feed_options = build_options(kwargs)
response_hook = kwargs.pop('response_hook', None)
if partition_key_range_id is not None:
@@ -372,7 +372,7 @@ def query_items( # pylint:disable=docstring-missing-param
session_token: Optional[str] = None,
initial_headers: Optional[Dict[str, str]] = None,
max_integrated_cache_staleness_in_ms: Optional[int] = None,
- priority_level: Optional[Literal["High", "Low"]] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
continuation_token_limit: Optional[int] = None,
**kwargs: Any
) -> ItemPaged[Dict[str, Any]]:
@@ -406,7 +406,7 @@ def query_items( # pylint:disable=docstring-missing-param
:keyword int max_integrated_cache_staleness_in_ms: The max cache staleness for the integrated cache in
milliseconds. For accounts configured to use the integrated cache, using Session or Eventual consistency,
responses are guaranteed to be no staler than this value.
- :keyword Literal["High", "Low"] priority_level: Priority based execution allows users to set a priority for each
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
request. Once the user has reached their provisioned throughput, low priority requests are throttled
before high priority requests start getting throttled. Feature must first be enabled at the account level.
:keyword bool populate_index_metrics: Used to obtain the index metrics to understand how the query engine used
@@ -437,8 +437,8 @@ def query_items( # pylint:disable=docstring-missing-param
kwargs['session_token'] = session_token
if initial_headers is not None:
kwargs['initial_headers'] = initial_headers
- if priority_level is not None:
- kwargs['priority_level'] = priority_level
+ if priority is not None:
+ kwargs['priority'] = priority
feed_options = build_options(kwargs)
response_hook = kwargs.pop('response_hook', None)
if enable_cross_partition_query is not None:
@@ -506,7 +506,7 @@ def replace_item( # pylint:disable=docstring-missing-param
initial_headers: Optional[Dict[str, str]] = None,
etag: Optional[str] = None,
match_condition: Optional[MatchConditions] = None,
- priority_level: Optional[Literal["High", "Low"]] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
**kwargs: Any
) -> Dict[str, Any]:
"""Replaces the specified item if it exists in the container.
@@ -525,7 +525,7 @@ def replace_item( # pylint:disable=docstring-missing-param
has changed, and act according to the condition specified by the `match_condition` parameter.
:keyword ~azure.core.MatchConditions match_condition: The match condition to use upon the etag.
:keyword Callable response_hook: A callable invoked with the response metadata.
- :keyword Literal["High", "Low"] priority_level: Priority based execution allows users to set a priority for each
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
request. Once the user has reached their provisioned throughput, low priority requests are throttled
before high priority requests start getting throttled. Feature must first be enabled at the account level.
:returns: A dict representing the item after replace went through.
@@ -542,8 +542,8 @@ def replace_item( # pylint:disable=docstring-missing-param
kwargs['session_token'] = session_token
if initial_headers is not None:
kwargs['initial_headers'] = initial_headers
- if priority_level is not None:
- kwargs['priority_level'] = priority_level
+ if priority is not None:
+ kwargs['priority'] = priority
if etag is not None:
kwargs['etag'] = etag
if match_condition is not None:
@@ -573,7 +573,7 @@ def upsert_item( # pylint:disable=docstring-missing-param
initial_headers: Optional[Dict[str, str]] = None,
etag: Optional[str] = None,
match_condition: Optional[MatchConditions] = None,
- priority_level: Optional[Literal["High", "Low"]] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
**kwargs: Any
) -> Dict[str, Any]:
"""Insert or update the specified item.
@@ -591,7 +591,7 @@ def upsert_item( # pylint:disable=docstring-missing-param
has changed, and act according to the condition specified by the `match_condition` parameter.
:keyword ~azure.core.MatchConditions match_condition: The match condition to use upon the etag.
:keyword Callable response_hook: A callable invoked with the response metadata.
- :keyword Literal["High", "Low"] priority_level: Priority based execution allows users to set a priority for each
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
request. Once the user has reached their provisioned throughput, low priority requests are throttled
before high priority requests start getting throttled. Feature must first be enabled at the account level.
:returns: A dict representing the upserted item.
@@ -606,8 +606,8 @@ def upsert_item( # pylint:disable=docstring-missing-param
kwargs['session_token'] = session_token
if initial_headers is not None:
kwargs['initial_headers'] = initial_headers
- if priority_level is not None:
- kwargs['priority_level'] = priority_level
+ if priority is not None:
+ kwargs['priority'] = priority
if etag is not None:
kwargs['etag'] = etag
if match_condition is not None:
@@ -642,7 +642,7 @@ def create_item( # pylint:disable=docstring-missing-param
initial_headers: Optional[Dict[str, str]] = None,
etag: Optional[str] = None,
match_condition: Optional[MatchConditions] = None,
- priority_level: Optional[Literal["High", "Low"]] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
**kwargs: Any
) -> Dict[str, Any]:
"""Create an item in the container.
@@ -664,7 +664,7 @@ def create_item( # pylint:disable=docstring-missing-param
has changed, and act according to the condition specified by the `match_condition` parameter.
:keyword ~azure.core.MatchConditions match_condition: The match condition to use upon the etag.
:keyword Callable response_hook: A callable invoked with the response metadata.
- :keyword Literal["High", "Low"] priority_level: Priority based execution allows users to set a priority for each
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
request. Once the user has reached their provisioned throughput, low priority requests are throttled
before high priority requests start getting throttled. Feature must first be enabled at the account level.
:returns: A dict representing the new item.
@@ -679,8 +679,8 @@ def create_item( # pylint:disable=docstring-missing-param
kwargs['session_token'] = session_token
if initial_headers is not None:
kwargs['initial_headers'] = initial_headers
- if priority_level is not None:
- kwargs['priority_level'] = priority_level
+ if priority is not None:
+ kwargs['priority'] = priority
if etag is not None:
kwargs['etag'] = etag
if match_condition is not None:
@@ -712,7 +712,7 @@ def patch_item(
session_token: Optional[str] = None,
etag: Optional[str] = None,
match_condition: Optional[MatchConditions] = None,
- priority_level: Optional[Literal["High", "Low"]] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
**kwargs: Any
) -> Dict[str, Any]:
""" Patches the specified item with the provided operations if it
@@ -734,7 +734,7 @@ def patch_item(
has changed, and act according to the condition specified by the `match_condition` parameter.
:keyword ~azure.core.MatchConditions match_condition: The match condition to use upon the etag.
:keyword Callable response_hook: A callable invoked with the response metadata.
- :keyword Literal["High", "Low"] priority_level: Priority based execution allows users to set a priority for each
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
request. Once the user has reached their provisioned throughput, low priority requests are throttled
before high priority requests start getting throttled. Feature must first be enabled at the account level.
:returns: A dict representing the item after the patch operations went through.
@@ -748,8 +748,8 @@ def patch_item(
kwargs['post_trigger_include'] = post_trigger_include
if session_token is not None:
kwargs['session_token'] = session_token
- if priority_level is not None:
- kwargs['priority_level'] = priority_level
+ if priority is not None:
+ kwargs['priority'] = priority
if etag is not None:
kwargs['etag'] = etag
if match_condition is not None:
@@ -775,6 +775,7 @@ def execute_item_batch(
session_token: Optional[str] = None,
etag: Optional[str] = None,
match_condition: Optional[MatchConditions] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
**kwargs: Any
) -> List[Dict[str, Any]]:
""" Executes the transactional batch for the specified partition key.
@@ -789,6 +790,9 @@ def execute_item_batch(
:keyword str etag: An ETag value, or the wildcard character (*). Used to check if the resource
has changed, and act according to the condition specified by the `match_condition` parameter.
:keyword ~azure.core.MatchConditions match_condition: The match condition to use upon the etag.
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
+ request. Once the user has reached their provisioned throughput, low priority requests are throttled
+ before high priority requests start getting throttled. Feature must first be enabled at the account level.
:keyword Callable response_hook: A callable invoked with the response metadata.
:returns: A list representing the item after the batch operations went through.
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: The batch failed to execute.
@@ -805,6 +809,8 @@ def execute_item_batch(
kwargs['etag'] = etag
if match_condition is not None:
kwargs['match_condition'] = match_condition
+ if priority is not None:
+ kwargs['priority'] = priority
request_options = build_options(kwargs)
request_options["partitionKey"] = self._set_partition_key(partition_key)
request_options["disableAutomaticIdGeneration"] = True
@@ -825,6 +831,7 @@ def delete_item( # pylint:disable=docstring-missing-param
initial_headers: Optional[Dict[str, str]] = None,
etag: Optional[str] = None,
match_condition: Optional[MatchConditions] = None,
+ priority: Optional[Literal["High", "Low"]] = None,
**kwargs: Any
) -> None:
"""Delete the specified item from the container.
@@ -842,6 +849,9 @@ def delete_item( # pylint:disable=docstring-missing-param
:keyword str etag: An ETag value, or the wildcard character (*). Used to check if the resource
has changed, and act according to the condition specified by the `match_condition` parameter.
:keyword ~azure.core.MatchConditions match_condition: The match condition to use upon the etag.
+ :keyword Literal["High", "Low"] priority: Priority based execution allows users to set a priority for each
+ request. Once the user has reached their provisioned throughput, low priority requests are throttled
+ before high priority requests start getting throttled. Feature must first be enabled at the account level.
:keyword Callable response_hook: A callable invoked with the response metadata.
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: The item wasn't deleted successfully.
:raises ~azure.cosmos.exceptions.CosmosResourceNotFoundError: The item does not exist in the container.
@@ -855,6 +865,8 @@ def delete_item( # pylint:disable=docstring-missing-param
kwargs['etag'] = etag
if match_condition is not None:
kwargs['match_condition'] = match_condition
+ if priority is not None:
+ kwargs['priority'] = priority
request_options = build_options(kwargs)
if partition_key is not None:
request_options["partitionKey"] = self._set_partition_key(partition_key)
diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/partition_key.py b/sdk/cosmos/azure-cosmos/azure/cosmos/partition_key.py
index 0b3f9b3d8048..d55c99bc8035 100644
--- a/sdk/cosmos/azure-cosmos/azure/cosmos/partition_key.py
+++ b/sdk/cosmos/azure-cosmos/azure/cosmos/partition_key.py
@@ -26,7 +26,7 @@
from typing import IO, Sequence, Type, Union, overload, List
from typing_extensions import Literal
-from ._cosmos_integers import UInt64, UInt128
+from ._cosmos_integers import _UInt64, _UInt128
from ._cosmos_murmurhash3 import murmurhash3_128
from ._routing.routing_range import Range
@@ -44,7 +44,7 @@
) * 3
-class PartitionKeyComponentType:
+class _PartitionKeyComponentType:
Undefined = 0x0
Null = 0x1
PFalse = 0x2
@@ -204,23 +204,23 @@ def _write_for_hashing_v2(
writer: IO[bytes]
) -> None:
if value is True:
- writer.write(bytes([PartitionKeyComponentType.PTrue]))
+ writer.write(bytes([_PartitionKeyComponentType.PTrue]))
elif value is False:
- writer.write(bytes([PartitionKeyComponentType.PFalse]))
+ writer.write(bytes([_PartitionKeyComponentType.PFalse]))
elif value is None or value == {} or value == NonePartitionKeyValue:
- writer.write(bytes([PartitionKeyComponentType.Null]))
+ writer.write(bytes([_PartitionKeyComponentType.Null]))
elif isinstance(value, int):
- writer.write(bytes([PartitionKeyComponentType.Number]))
+ writer.write(bytes([_PartitionKeyComponentType.Number]))
writer.write(value.to_bytes(8, 'little')) # assuming value is a 64-bit integer
elif isinstance(value, float):
- writer.write(bytes([PartitionKeyComponentType.Number]))
+ writer.write(bytes([_PartitionKeyComponentType.Number]))
writer.write(struct.pack(' None:
if isinstance(value, bool):
- binary_writer.write(bytes([(PartitionKeyComponentType.PTrue if value else PartitionKeyComponentType.PFalse)]))
+ binary_writer.write(bytes([(_PartitionKeyComponentType.PTrue if value else _PartitionKeyComponentType.PFalse)]))
elif isinstance(value, _Infinity):
- binary_writer.write(bytes([PartitionKeyComponentType.Infinity]))
+ binary_writer.write(bytes([_PartitionKeyComponentType.Infinity]))
elif isinstance(value, (int, float)): # Assuming number value is int or float
- binary_writer.write(bytes([PartitionKeyComponentType.Number]))
- payload = UInt64.encode_double_as_uint64(value) # Function to be defined elsewhere
+ binary_writer.write(bytes([_PartitionKeyComponentType.Number]))
+ payload = _UInt64.encode_double_as_uint64(value) # Function to be defined elsewhere
# Encode first chunk with 8-bits of payload
binary_writer.write(bytes([(payload >> (64 - 8))]))
@@ -323,7 +323,7 @@ def _write_for_binary_encoding(
binary_writer.write(bytes([(byte_to_write & 0xFE)]))
elif isinstance(value, str):
- binary_writer.write(bytes([PartitionKeyComponentType.String]))
+ binary_writer.write(bytes([_PartitionKeyComponentType.String]))
utf8_value = value.encode('utf-8')
short_string = len(utf8_value) <= _MaxStringBytesToAppend
@@ -337,4 +337,4 @@ def _write_for_binary_encoding(
binary_writer.write(bytes([0x00]))
elif isinstance(value, _Undefined):
- binary_writer.write(bytes([PartitionKeyComponentType.Undefined]))
+ binary_writer.write(bytes([_PartitionKeyComponentType.Undefined]))
diff --git a/sdk/cosmos/azure-cosmos/test/test_crud.py b/sdk/cosmos/azure-cosmos/test/test_crud.py
index b474b7983901..c09d69f5cc20 100644
--- a/sdk/cosmos/azure-cosmos/test/test_crud.py
+++ b/sdk/cosmos/azure-cosmos/test/test_crud.py
@@ -2629,38 +2629,41 @@ def test_priority_level(self):
item1 = {"id": "item1", "pk": "pk1"}
item2 = {"id": "item2", "pk": "pk2"}
self.OriginalExecuteFunction = _retry_utility.ExecuteFunction
- priority_level_headers = []
+ priority_headers = []
# mock execute function to check if priority level set in headers
def priority_mock_execute_function(function, *args, **kwargs):
if args:
- priority_level_headers.append(args[4].headers[HttpHeaders.PriorityLevel]
+ priority_headers.append(args[4].headers[HttpHeaders.PriorityLevel]
if HttpHeaders.PriorityLevel in args[4].headers else '')
return self.OriginalExecuteFunction(function, *args, **kwargs)
_retry_utility.ExecuteFunction = priority_mock_execute_function
# upsert item with high priority
- created_container.upsert_item(body=item1, priority_level="High")
+ created_container.upsert_item(body=item1, priority="High")
# check if the priority level was passed
- self.assertEqual(priority_level_headers[-1], "High")
+ self.assertEqual(priority_headers[-1], "High")
# upsert item with low priority
- created_container.upsert_item(body=item2, priority_level="Low")
+ created_container.upsert_item(body=item2, priority="Low")
# check that headers passed low priority
- self.assertEqual(priority_level_headers[-1], "Low")
+ self.assertEqual(priority_headers[-1], "Low")
# Repeat for read operations
- item1_read = created_container.read_item("item1", "pk1", priority_level="High")
- self.assertEqual(priority_level_headers[-1], "High")
- item2_read = created_container.read_item("item2", "pk2", priority_level="Low")
- self.assertEqual(priority_level_headers[-1], "Low")
+ item1_read = created_container.read_item("item1", "pk1", priority="High")
+ self.assertEqual(priority_headers[-1], "High")
+ item2_read = created_container.read_item("item2", "pk2", priority="Low")
+ self.assertEqual(priority_headers[-1], "Low")
# repeat for query
- query = list(created_container.query_items("Select * from c", partition_key="pk1", priority_level="High"))
+ query = list(created_container.query_items("Select * from c", partition_key="pk1", priority="High"))
- self.assertEqual(priority_level_headers[-1], "High")
+ self.assertEqual(priority_headers[-1], "High")
# Negative Test: Verify that if we send a value other than High or Low that it will not set the header value
- item2_read = created_container.read_item("item2", "pk2", priority_level="Medium")
- self.assertNotEqual(priority_level_headers[-1], "Medium")
+ # and result in bad request
+ try:
+ item2_read = created_container.read_item("item2", "pk2", priority="Medium")
+ except exceptions.CosmosHttpResponseError as e:
+ self.assertEqual(e.status_code, StatusCodes.BAD_REQUEST)
_retry_utility.ExecuteFunction = self.OriginalExecuteFunction
def _MockExecuteFunction(self, function, *args, **kwargs):
diff --git a/sdk/cosmos/azure-cosmos/test/test_crud_async.py b/sdk/cosmos/azure-cosmos/test/test_crud_async.py
index 452590eec8c7..49c9fccf7bed 100644
--- a/sdk/cosmos/azure-cosmos/test/test_crud_async.py
+++ b/sdk/cosmos/azure-cosmos/test/test_crud_async.py
@@ -2461,39 +2461,42 @@ async def test_priority_level_async(self):
item1 = {"id": "item1", "pk": "pk1"}
item2 = {"id": "item2", "pk": "pk2"}
self.OriginalExecuteFunction = _retry_utility_async.ExecuteFunctionAsync
- priority_level_headers = []
+ priority_headers = []
# mock execute function to check if priority level set in headers
async def priority_mock_execute_function(function, *args, **kwargs):
if args:
- priority_level_headers.append(args[4].headers[HttpHeaders.PriorityLevel]
+ priority_headers.append(args[4].headers[HttpHeaders.PriorityLevel]
if HttpHeaders.PriorityLevel in args[4].headers else '')
return await self.OriginalExecuteFunction(function, *args, **kwargs)
_retry_utility_async.ExecuteFunctionAsync = priority_mock_execute_function
# upsert item with high priority
- await created_container.upsert_item(body=item1, priority_level="High")
+ await created_container.upsert_item(body=item1, priority="High")
# check if the priority level was passed
- assert priority_level_headers[-1] == "High"
+ assert priority_headers[-1] == "High"
# upsert item with low priority
- await created_container.upsert_item(body=item2, priority_level="Low")
+ await created_container.upsert_item(body=item2, priority="Low")
# check that headers passed low priority
- assert priority_level_headers[-1] == "Low"
+ assert priority_headers[-1] == "Low"
# Repeat for read operations
- item1_read = await created_container.read_item("item1", "pk1", priority_level="High")
- assert priority_level_headers[-1] == "High"
- item2_read = await created_container.read_item("item2", "pk2", priority_level="Low")
- assert priority_level_headers[-1] == "Low"
+ item1_read = await created_container.read_item("item1", "pk1", priority="High")
+ assert priority_headers[-1] == "High"
+ item2_read = await created_container.read_item("item2", "pk2", priority="Low")
+ assert priority_headers[-1] == "Low"
# repeat for query
query = [doc async for doc in created_container.query_items("Select * from c",
- partition_key="pk1", priority_level="High")]
+ partition_key="pk1", priority="High")]
- assert priority_level_headers[-1] == "High"
+ assert priority_headers[-1] == "High"
# Negative Test: Verify that if we send a value other than High or Low that it will not set the header value
- item2_read = await created_container.read_item("item2", "pk2", priority_level="Medium")
- assert priority_level_headers[-1] != "Medium"
+ # and result in bad request
+ try:
+ item2_read = created_container.read_item("item2", "pk2", priority="Medium")
+ except exceptions.CosmosHttpResponseError as e:
+ assert e.status_code == StatusCodes.BAD_REQUEST
_retry_utility_async.ExecuteFunctionAsync = self.OriginalExecuteFunction
async def _mock_execute_function(self, function, *args, **kwargs):
diff --git a/sdk/cosmos/azure-cosmos/test/test_murmurhash3.py b/sdk/cosmos/azure-cosmos/test/test_murmurhash3.py
index a261a645b2ea..5990b2d62e8e 100644
--- a/sdk/cosmos/azure-cosmos/test/test_murmurhash3.py
+++ b/sdk/cosmos/azure-cosmos/test/test_murmurhash3.py
@@ -6,7 +6,7 @@
import pytest
-from azure.cosmos._cosmos_integers import UInt128
+from azure.cosmos._cosmos_integers import _UInt128
from azure.cosmos._cosmos_murmurhash3 import murmurhash3_128
@@ -16,7 +16,7 @@ class TestMurmurHash3(unittest.TestCase):
"""
string_low_value = 2792699143512860960
string_high_value = 15069672278200047189
- test_seed = UInt128(0, 0)
+ test_seed = _UInt128(0, 0)
float_low_value = 16628891264555680919
float_high_value = 12953474369317462