Skip to content

Commit 19f6f37

Browse files
authored
Upgrade Table SDK from T1 to T2
1 parent 9a55a22 commit 19f6f37

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

articles/cosmos-db/table/how-to-use-python.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,26 @@ from azure.data.tables import TableServiceClient
6464
from azure.data.tables import TableEntity
6565
```
6666

67-
## Creating the client from a shared key
67+
## Connect to Azure Table service
68+
You can either connect to the Azure Storage account or the Azure Cosmos DB Table API account. Get the shared key or connection string based on the type of account you are using.
6869

69-
Create a `TableServiceClient` object, and pass in your Cosmos DB account name and account key. Replace `myaccount` and `mykey` with your account name and key.
70+
### Creating the Table service client from a shared key
71+
72+
Create a `TableServiceClient` object, and pass in your Cosmos DB or Storage account name, account key and table endpoint. Replace `myaccount`, `mykey` and `mytableendpoint` with your Cosmos DB or Storage account name, key and table endpoint.
7073

7174
```python
7275
from azure.core.credentials import AzureNamedKeyCredential
7376

7477
credential = AzureNamedKeyCredential("myaccount", "mykey")
75-
table_service = TableServiceClient(endpoint="https://<myaccount>.table.cosmos.azure.com:443/", credential=credential)
78+
table_service = TableServiceClient(endpoint="mytableendpoint", credential=credential)
7679
```
7780

78-
## Creating the client from a connection string
81+
### Creating the Table service client from a connection string
7982

80-
Copy your Cosmos DB primary connection string from the Azure portal, and create a `TableServiceClient` object using your copied connection string:
83+
Copy your Cosmos DB or Storage account connection string from the Azure portal, and create a `TableServiceClient` object using your copied connection string:
8184

8285
```python
83-
table_service = TableServiceClient.from_connection_string(conn_str='DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=mykey;TableEndpoint=myendpoint;')
86+
table_service = TableServiceClient.from_connection_string(conn_str='DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=mykey;TableEndpoint=mytableendpoint;')
8487
```
8588

8689
## Create a table

0 commit comments

Comments
 (0)