You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sdk/cosmos/azure-cosmos/README.md
+46-51Lines changed: 46 additions & 51 deletions
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ Use the Azure Cosmos DB SQL API SDK for Python to manage databases and the JSON
13
13
14
14
15
15
## Getting started
16
-
16
+
### Prerequisites
17
17
* Azure subscription - [Create a free account][azure_sub]
18
18
* Azure [Cosmos DB account][cosmos_account] - SQL API
19
19
*[Python 2.7 or 3.5.3+][python]
@@ -25,27 +25,24 @@ If you need a Cosmos DB SQL API account, you can create one with this [Azure CLI
25
25
az cosmosdb create --resource-group <resource-group-name> --name <cosmos-account-name>
26
26
```
27
27
28
-
##Installation
28
+
### Install the package
29
29
30
30
```bash
31
31
pip install azure-cosmos
32
32
```
33
33
34
-
### Configure a virtual environment (optional)
34
+
####Configure a virtual environment (optional)
35
35
36
36
Although not required, you can keep your your base system and Azure SDK environments isolated from one another if you use a virtual environment. Execute the following commands to configure and then enter a virtual environment with [venv][venv]:
Interaction with Cosmos DB starts with an instance of the [CosmosClient][ref_cosmosclient] class. You need an **account**, its **URI**, and one of its **account keys** to instantiate the client object.
46
45
47
-
### Get credentials
48
-
49
46
Use the Azure CLI snippet below to populate two environment variables with the database account URI and its primary master key (you can also find these values in the Azure portal). The snippet is formatted for the Bash shell.
Once you've populated the `ACCOUNT_URI` and `ACCOUNT_KEY` environment variables, you can create the [CosmosClient][ref_cosmosclient].
62
58
@@ -69,7 +65,7 @@ key = os.environ['ACCOUNT_KEY']
69
65
client = CosmosClient(url, credential=key)
70
66
```
71
67
72
-
## Usage
68
+
## Key concepts
73
69
74
70
Once you've initialized a [CosmosClient][ref_cosmosclient], you can interact with the primary resource types in Cosmos DB:
75
71
@@ -155,8 +151,9 @@ for i in range(1, 10):
155
151
To delete items from a container, use [ContainerProxy.delete_item][ref_container_delete_item]. The SQL API in Cosmos DB does not support the SQL `DELETE` statement.
156
152
157
153
```Python
158
-
for item in container.query_items(query='SELECT * FROM products p WHERE p.productModel = "DISCONTINUED"',
159
-
enable_cross_partition_query=True):
154
+
for item in container.query_items(
155
+
query='SELECT * FROM products p WHERE p.productModel = "DISCONTINUED"',
0 commit comments