From 19ce0dc43f0efa3450f640b67a392e6ed785f991 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Tue, 1 Jun 2021 14:52:18 -0700 Subject: [PATCH 1/3] prepare-release --- sdk/tables/azure-data-tables/CHANGELOG.md | 2 +- sdk/tables/azure-data-tables/azure/data/tables/_version.py | 2 +- sdk/tables/azure-data-tables/setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/tables/azure-data-tables/CHANGELOG.md b/sdk/tables/azure-data-tables/CHANGELOG.md index 1de7c105aa0a..ec1cfe2a3e2c 100644 --- a/sdk/tables/azure-data-tables/CHANGELOG.md +++ b/sdk/tables/azure-data-tables/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 12.0.0 (unreleased) +## 12.0.0 (2021-06-08) **Breaking** * EdmType.Binary data in entities will now be deserialized as `bytes` in Python 3 and `str` in Python 2, rather than an `EdmProperty` instance. Likewise on serialization, `bytes` in Python 3 and `str` in Python 2 will be interpreted as binary (this is unchanged for Python 3, but breaking for Python 2, where `str` was previously serialized as EdmType.String) * `TableClient.create_table` now returns an instance of `TableItem`. diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_version.py b/sdk/tables/azure-data-tables/azure/data/tables/_version.py index 37b2923997a4..63dfa66aca46 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_version.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_version.py @@ -4,4 +4,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "12.0.0b7" +VERSION = "12.0.0" diff --git a/sdk/tables/azure-data-tables/setup.py b/sdk/tables/azure-data-tables/setup.py index 9c1043f5039a..634b9c277936 100644 --- a/sdk/tables/azure-data-tables/setup.py +++ b/sdk/tables/azure-data-tables/setup.py @@ -60,7 +60,7 @@ author_email='ascl@microsoft.com', url='https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/table/azure-table', classifiers=[ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', From 46a6810fd8f97ae102e26f3535b5d276efd11b55 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Thu, 3 Jun 2021 09:21:44 -0700 Subject: [PATCH 2/3] type hint fixes --- .../azure/data/tables/_models.py | 8 ++++++++ .../azure/data/tables/_table_client.py | 6 ++---- .../azure/data/tables/_table_service_client.py | 4 +--- .../tables/_table_shared_access_signature.py | 6 ++---- .../azure/data/tables/aio/_table_client_async.py | 16 ++++++---------- .../tables/aio/_table_service_client_async.py | 3 ++- 6 files changed, 21 insertions(+), 22 deletions(-) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_models.py b/sdk/tables/azure-data-tables/azure/data/tables/_models.py index 18802ec9bf0e..ab22bc3ec317 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_models.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_models.py @@ -400,10 +400,18 @@ def __init__( def __or__(self, other): # type: (TableSasPermissions) -> TableSasPermissions + """ + :param other: + :type other: :class:`~azure.data.tables.TableSasPermissions` + """ return TableSasPermissions(_str=str(self) + str(other)) def __add__(self, other): # type: (TableSasPermissions) -> TableSasPermissions + """ + :param other: + :type other: :class:`~azure.data.tables.TableSasPermissions` + """ return TableSasPermissions(_str=str(self) + str(other)) def __str__(self): diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py index 26f464aafc3e..db3d99ebd3bb 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py @@ -73,9 +73,7 @@ def __init__( account URL already has a SAS token, or the connection string already has shared access key values. The value can be a SAS token string or an account shared access key. - :type credential: - :class:`~azure.core.credentials.AzureNamedKeyCredential` or - :class:`~azure.core.credentials.AzureSasCredential` + :type credential: ~azure.core.credentials.AzureNamedKeyCredential or ~azure.core.credentials.AzureSasCredential :returns: None """ if not table_name: @@ -366,7 +364,7 @@ def create_entity( """Insert entity in a table. :param entity: The properties for the table entity. - :type entity: Dict[str,str] or :class:`~azure.data.tables.TableEntity` + :type entity: Union[TableEntity, Mapping[str, Any]] :return: Dictionary mapping operation metadata returned from the service :rtype: Dict[str,str] :raises: :class:`~azure.core.exceptions.HttpResponseError` diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_service_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_service_client.py index 5bd6eaa9d8ac..cb26162d8635 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_table_service_client.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_service_client.py @@ -46,9 +46,7 @@ class TableServiceClient(TablesBaseClient): The credentials with which to authenticate. This is optional if the account URL already has a SAS token. The value can be one of AzureNamedKeyCredential or AzureSasCredential from azure-core. - :type credential: - :class:`~azure.core.credentials.AzureNamedKeyCredential` or - :class:`~azure.core.credentials.AzureSasCredential` + :type credential: ~azure.core.credentials.AzureNamedKeyCredential or ~azure.core.credentials.AzureSasCredential :keyword str api_version: The Storage API version to use for requests. Default value is '2019-02-02'. Setting to an older version may result in reduced feature compatibility. diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_shared_access_signature.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_shared_access_signature.py index 789aa935456c..0be4ae08f849 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_table_shared_access_signature.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_shared_access_signature.py @@ -96,10 +96,8 @@ def generate_table_sas( Use the returned signature with the sas_token parameter of TableService. - :param account_key: Account key - :type account_key: str - :param account_name: Account name - :type account_name: str + :param credential: Credential used for creating Shared Access Signature + :type credential: :class:`~azure.core.credentials.AzureNamedKeyCredential` :param table_name: Table name :type table_name: str :keyword TableSasPermissions permission: diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py index 98c0dfffd695..e24c89784b80 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py @@ -63,9 +63,7 @@ def __init__( account URL already has a SAS token, or the connection string already has shared access key values. The value can be a SAS token string or an account shared access key. - :type credential: - :class:`~azure.core.credentials.AzureNamedKeyCredential` or - :class:`~azure.core.credentials.AzureSasCredential` + :type credential: ~azure.core.credentials.AzureNamedKeyCredential or ~azure.core.credentials.AzureSasCredential :returns: None """ @@ -123,9 +121,7 @@ def from_table_url( The credentials with which to authenticate. This is optional if the account URL already has a SAS token. The value can be a SAS token string, an account shared access key. - :type credential: - :class:`~azure.core.credentials.AzureNamedKeyCredential` or - :class:`~azure.core.credentials.AzureSasCredential` + :type credential: ~azure.core.credentials.AzureNamedKeyCredential or ~azure.core.credentials.AzureSasCredential :returns: A table client. :rtype: :class:`~azure.data.tables.TableClient` """ @@ -222,7 +218,7 @@ async def set_table_access_policy( raise @distributed_trace_async - async def create_table(self, **kwargs) -> None: + async def create_table(self, **kwargs) -> TableItem: """Creates a new table under the given account. :return: A TableItem representing the created table. @@ -353,7 +349,7 @@ async def create_entity( """Insert entity in a table. :param entity: The properties for the table entity. - :type entity: :class:`~azure.data.tables.TableEntity` or Dict[str,str] + :type entity: Union[TableEntity, Mapping[str, Any]] :return: Dictionary mapping operation metadata returned from the service :rtype: Dict[str,str] :raises: :class:`~azure.core.exceptions.ResourceExistsError` If the entity already exists @@ -470,7 +466,7 @@ def list_entities(self, **kwargs) -> AsyncItemPaged[TableEntity]: :keyword select: Specify desired properties of an entity to return. :paramtype select: str or List[str] :return: AsyncItemPaged[:class:`~azure.data.tables.TableEntity`] - :rtype: ~azure.core.async_paging.AsyncItemPaged + :rtype: ~azure.core.async_paging.AsyncItemPaged[TableEntity] :raises: :class:`~azure.core.exceptions.HttpResponseError` .. admonition:: Example: @@ -511,7 +507,7 @@ def query_entities( :keyword parameters: Dictionary for formatting query with additional, user defined parameters :paramtype parameters: Dict[str, Any] :return: AsyncItemPaged[:class:`~azure.data.tables.TableEntity`] - :rtype: ~azure.core.async_paging.AsyncItemPaged + :rtype: ~azure.core.async_paging.AsyncItemPaged[TableEntity] :raises: :class:`~azure.core.exceptions.HttpResponseError` .. admonition:: Example: diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_service_client_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_service_client_async.py index 0ef872977c48..53c7c0a11678 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_service_client_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_service_client_async.py @@ -46,10 +46,11 @@ class TableServiceClient(AsyncTablesBaseClient): The URL to the table service endpoint. Any other entities included in the URL path (e.g. table) will be discarded. This URL can be optionally authenticated with a SAS token. - :param str credential: + :param credential: The credentials with which to authenticate. This is optional if the account URL already has a SAS token. The value can be a SAS token string, an account shared access key. + :type credential: ~azure.core.credentials.AzureNamedKeyCredential or ~azure.core.credentials.AzureSasCredential :keyword str api_version: The Storage API version to use for requests. Default value is '2019-02-02'. Setting to an older version may result in reduced feature compatibility. From d531dc756f74a765fb7d8fa63370a226e4e90200 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Mon, 7 Jun 2021 07:12:22 -0700 Subject: [PATCH 3/3] adding union --- sdk/tables/azure-data-tables/azure/data/tables/_base_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py index e76d0bd32372..dee6b80de13e 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py @@ -4,7 +4,7 @@ # license information. # -------------------------------------------------------------------------- -from typing import Dict, Optional, Any, List, Mapping +from typing import Dict, Optional, Any, List, Mapping, Union from uuid import uuid4 try: from urllib.parse import parse_qs, quote, urlparse