[Tables] fixing readme
@@ -22,7 +22,7 @@ The Azure Data Tables SDK can access an Azure Storage or CosmosDB account.
### Install the package
Install the Azure Data Tables client library for Python with [pip][pip_link]:
```bash
-pip install --pre azure-data-tables
+pip install azure-data-tables
```
#### Create the client
@@ -59,8 +59,12 @@ az storage account keys list -g MyResourceGroup -n MyStorageAccount
Use the key as the credential parameter to authenticate the client:
```python
+from azure.core.credentials import AzureNamedKeyCredential
from azure.data.tables import TableServiceClient
- service = TableServiceClient(endpoint="https://<my_account_name>.table.core.windows.net", credential="<account_access_key>")
+
+credential = AzureNamedKeyCredential("my_account_name", "my_access_key")
+
+service = TableServiceClient(endpoint="https://<my_account_name>.table.core.windows.net", credential=credential)
```
##### Creating the client from a connection string
@@ -84,16 +88,17 @@ To use a [shared access signature (SAS) token][azure_sas_token], provide the tok
```python
from datetime import datetime, timedelta
from azure.data.tables import TableServiceClient, generate_account_sas, ResourceTypes, AccountSasPermissions
+from azure.core.credentials import AzureNamedKeyCredential, AzureSasCredential
+credential = AzureNamedKeyCredential("my_account_name", "my_access_key")
sas_token = generate_account_sas(
- account_name="<account-name>",
- account_key="<account-access-key>",
+ credential,
resource_types=ResourceTypes(service=True),
permission=AccountSasPermissions(read=True),
- expiry=datetime.utcnow() + timedelta(hours=1)
+ expiry=datetime.utcnow() + timedelta(hours=1),
)
- table_service_client = TableServiceClient(endpoint="https://<my_account_name>.table.core.windows.net", credential=sas_token)
+table_service_client = TableServiceClient(endpoint="https://<my_account_name>.table.core.windows.net", credential=AzureSasCredential(sas_token))
```
