Skip to content

Commit 446d649

Browse files
authored
Added best practice notes to the CosmosClient docs (Azure#30765)
1 parent fead0e3 commit 446d649

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

sdk/cosmos/azure-cosmos/azure/cosmos/aio/_cosmos_client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ class CosmosClient(object): # pylint: disable=client-accepts-api-version-keywor
9595
9696
Use this client to configure and execute requests to the Azure Cosmos DB service.
9797
98+
Its recommended to maintain a single instance of CosmosClient per lifetime of the application which enables
99+
efficient connection management and performance.
100+
101+
CosmosClient initialization is a heavy operation - don't use initialization CosmosClient instances as
102+
credentials or network connectivity validations.
103+
98104
:param str url: The URL of the Cosmos DB account.
99105
:param credential: Can be the account key, or a dictionary of resource tokens.
100106
:type credential: Union[str, Dict[str, str], ~azure.core.credentials_async.AsyncTokenCredential]

sdk/cosmos/azure-cosmos/azure/cosmos/cosmos_client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ class CosmosClient(object): # pylint: disable=client-accepts-api-version-keywor
135135
136136
Use this client to configure and execute requests to the Azure Cosmos DB service.
137137
138+
Its recommended to maintain a single instance of CosmosClient per lifetime of the application which enables
139+
efficient connection management and performance.
140+
141+
CosmosClient initialization is a heavy operation - don't use initialization CosmosClient instances as
142+
credentials or network connectivity validations.
143+
138144
:param str url: The URL of the Cosmos DB account.
139145
:param credential: Can be the account key, or a dictionary of resource tokens.
140146
:type credential: Union[str, Dict[str, str], ~azure.core.credentials.TokenCredential]

0 commit comments

Comments
 (0)