diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/aio/container.py b/sdk/cosmos/azure-cosmos/azure/cosmos/aio/container.py index 115e3ca22c44..b90cf250b634 100644 --- a/sdk/cosmos/azure-cosmos/azure/cosmos/aio/container.py +++ b/sdk/cosmos/azure-cosmos/azure/cosmos/aio/container.py @@ -210,15 +210,15 @@ async def create_item( async def read_item( self, item: Union[str, Dict[str, Any]], - partition_key: Union[str, int, float, bool], + partition_key: str, **kwargs: Any ) -> Dict[str, Any]: """Get the item identified by `item`. :param item: The ID (name) or dict representing item to retrieve. :type item: Union[str, Dict[str, Any]] - :param partition_key: Partition key for the item to retrieve. - :type partition_key: Union[str, int, float, bool] + :param str partition_key: Partition key for the item to retrieve. + :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 response_hook: A callable invoked with the response metadata. @@ -314,7 +314,7 @@ def query_items( Each parameter is a dict() with 'name' and 'value' keys. Ignored if no query is provided. :type parameters: Optional[List[Dict[str, Any]]] - :param partition_key: Specifies the partition key value for the item. If none is provided, + :param str partition_key: Specifies the partition key value for the item. If none is provided, a cross-partition query will be executed. :type partition_key: Optional[Union[str, int, float, bool]] :keyword int max_item_count: Max number of items to be returned in the enumeration operation. @@ -400,8 +400,7 @@ def query_items_change_feed( beginning (true) or from current (false). By default it's start from current (false). :keyword str continuation: e_tag value to be used as continuation for reading change feed. :keyword int max_item_count: Max number of items to be returned in the enumeration operation. - :keyword partition_key: partition key at which ChangeFeed requests are targeted. - :paramtype partition_key: Union[str, int, float, bool] + :keyword str partition_key: partition key at which ChangeFeed requests are targeted. :keyword response_hook: A callable invoked with the response metadata. :paramtype response_hook: Callable[[Dict[str, str], AsyncItemPaged[Dict[str, Any]]], Any] :returns: An AsyncItemPaged of items (dicts). @@ -531,7 +530,7 @@ async def replace_item( async def delete_item( self, item: Union[str, Dict[str, Any]], - partition_key: Union[str, int, float, bool], + partition_key: str, **kwargs: Any ) -> None: """Delete the specified item from the container. @@ -540,8 +539,7 @@ async def delete_item( :param item: The ID (name) or dict representing item to be deleted. :type item: Union[str, Dict[str, Any]] - :param partition_key: Specifies the partition key value for the item. - :type partition_key: Union[str, int, float, bool] + :param str partition_key: Specifies the partition key value for the item. :keyword str pre_trigger_include: trigger id to be used as pre operation trigger. :keyword str post_trigger_include: trigger id to be used as post operation trigger. :keyword str session_token: Token for use with Session consistency. @@ -673,9 +671,8 @@ def query_conflicts( :param str query: The Azure Cosmos DB SQL query to execute. :param parameters: Optional array of parameters to the query. Ignored if no query is provided. :type parameters: Optional[List[Dict[str, Any]]] - :param partition_key: Specifies the partition key value for the item. If none is passed in, a + :param str partition_key: Specifies the partition key value for the item. If none is passed in, a cross partition query will be executed. - :type partition_key: Union[str, int, float, bool] :keyword int max_item_count: Max number of items to be returned in the enumeration operation. :keyword response_hook: A callable invoked with the response metadata. :paramtype response_hook: Callable[[Dict[str, str], AsyncItemPaged[Dict[str, Any]]], Any] @@ -706,15 +703,14 @@ def query_conflicts( async def read_conflict( self, conflict: Union[str, Dict[str, Any]], - partition_key: Union[str, int, float, bool], + partition_key: str, **kwargs: Any, ) -> Dict[str, Any]: """Get the conflict identified by `conflict`. :param conflict: The ID (name) or dict representing the conflict to retrieve. :type conflict: Union[str, Dict[str, Any]] - :param partition_key: Partition key for the conflict to retrieve. - :type partition_key: Union[str, int, float, bool] + :param str partition_key: Partition key for the conflict to retrieve. :keyword response_hook: A callable invoked with the response metadata. :paramtype response_hook: Callable[[Dict[str, str], Dict[str, Any]], Any] :raises ~azure.cosmos.exceptions.CosmosHttpResponseError: The given conflict couldn't be retrieved. @@ -735,7 +731,7 @@ async def read_conflict( async def delete_conflict( self, conflict: Union[str, Dict[str, Any]], - partition_key: Union[str, int, float, bool], + partition_key: str, **kwargs: Any, ) -> None: """Delete a specified conflict from the container. @@ -744,8 +740,7 @@ async def delete_conflict( :param conflict: The ID (name) or dict representing the conflict to retrieve. :type conflict: Union[str, Dict[str, Any]] - :param partition_key: Partition key for the conflict to retrieve. - :type partition_key: Union[str, int, float, bool] + :param str partition_key: Partition key for the conflict to retrieve. :keyword response_hook: A callable invoked with the response metadata. :paramtype response_hook: Callable[[Dict[str, str], None], Any] :raises ~azure.cosmos.exceptions.CosmosHttpResponseError: The conflict wasn't deleted successfully. diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/aio/database.py b/sdk/cosmos/azure-cosmos/azure/cosmos/aio/database.py index 95fa6cd38282..310112a57c91 100644 --- a/sdk/cosmos/azure-cosmos/azure/cosmos/aio/database.py +++ b/sdk/cosmos/azure-cosmos/azure/cosmos/aio/database.py @@ -410,7 +410,7 @@ def query_containers( async def replace_container( self, container: Union[str, ContainerProxy, Dict[str, Any]], - partition_key: Union[str, int, float, bool], + partition_key: PartitionKey, **kwargs: Any ) -> ContainerProxy: """Reset the properties of the container. @@ -422,7 +422,7 @@ async def replace_container( :class:`ContainerProxy` instance of the container to be replaced. :type container: Union[str, Dict[str, Any], ~azure.cosmos.aio.ContainerProxy] :param partition_key: The partition key to use for the container. - :type partition_key: Union[str, int, float, bool] + :type partition_key: ~azure.cosmos.partition_key.PartitionKey :keyword Dict[str, str] indexing_policy: The indexing policy to apply to the container. :keyword int default_ttl: Default time to live (TTL) for items in the container. If unspecified, items do not expire. diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/aio/scripts.py b/sdk/cosmos/azure-cosmos/azure/cosmos/aio/scripts.py index 1f514c788add..372c83c7d6f2 100644 --- a/sdk/cosmos/azure-cosmos/azure/cosmos/aio/scripts.py +++ b/sdk/cosmos/azure-cosmos/azure/cosmos/aio/scripts.py @@ -197,7 +197,7 @@ async def delete_stored_procedure(self, sproc: Union[str, Dict[str, Any]], **kwa async def execute_stored_procedure( self, sproc: Union[str, Dict[str, Any]], - partition_key: Optional[Union[str, int, float, bool]] = None, + partition_key: Optional[str] = None, params: Optional[List[Dict[str, Any]]] = None, **kwargs: Any ) -> Dict[str, Any]: @@ -207,9 +207,8 @@ async def execute_stored_procedure( :param sproc: The ID (name) or dict representing the stored procedure to be executed. :type sproc: Union[str, Dict[str, Any]] - :param partition_key: Specifies the partition key to indicate which partition the stored procedure should + :param Optional[str] partition_key: Specifies the partition key to indicate which partition the stored procedure should execute on. - :type partition_key: Optional[Union[str, int, float, bool]] :param params: List of parameters to be passed to the stored procedure to be executed. :type params: Optional[List[Dict[str, Any]]] :keyword bool enable_script_logging: Enables or disables script logging for the current request.