From c4e5329548e092d2d648e380a6cadaee4bb854be Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Tue, 26 Jan 2021 09:08:38 -0500 Subject: [PATCH 1/7] three tests, changes to include entity_hook for sync code --- .../azure/data/tables/_models.py | 12 +- .../azure/data/tables/_table_client.py | 21 +- ...test_custom_entity.test_custom_entity.yaml | 186 ++++++++++++ ...custom_entity.test_custom_entity_list.yaml | 236 ++++++++++++++++ ...ustom_entity.test_custom_entity_query.yaml | 236 ++++++++++++++++ .../tests/test_custom_entity.py | 266 ++++++++++++++++++ 6 files changed, 952 insertions(+), 5 deletions(-) create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_list.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_query.yaml create mode 100644 sdk/tables/azure-data-tables/tests/test_custom_entity.py 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 5cb134af43f1..063e35e83848 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_models.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_models.py @@ -323,13 +323,15 @@ class TableEntityPropertiesPaged(PageIterator): :keyword str continuation_token: An opaque continuation token. :keyword str location_mode: The location mode being used to list results. The available options include "primary" and "secondary". + :keyword callabel entity_hook: A custom entity type for deserialization entities returned + from the service """ def __init__(self, command, table, **kwargs): super(TableEntityPropertiesPaged, self).__init__( self._get_next_cb, self._extract_data_cb, - continuation_token=kwargs.get("continuation_token") or {}, + continuation_token=kwargs.get("continuation_token", {}), ) self._command = command self._headers = None @@ -339,6 +341,7 @@ def __init__(self, command, table, **kwargs): self.filter = kwargs.get("filter") self.select = kwargs.get("select") self.location_mode = None + self.entity_hook = kwargs.get("entity_hook", None) def _get_next_cb(self, continuation_token, **kwargs): next_partition_key, next_row_key = _extract_continuation_token( @@ -359,9 +362,14 @@ def _get_next_cb(self, continuation_token, **kwargs): except HttpResponseError as error: _process_table_error(error) + def _get_props_list(self): + if self.entity_hook: + return [self.entity_hook(t) for t in self._response.value] + return [_convert_to_entity(t) for t in self._response.value] + def _extract_data_cb(self, get_next_return): self.location_mode, self._response, self._headers = get_next_return - props_list = [_convert_to_entity(t) for t in self._response.value] + props_list = self._get_props_list() next_entity = {} if self._headers[NEXT_PARTITION_KEY] or self._headers[NEXT_ROW_KEY]: next_entity = { 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 f33c60ce3a32..c88991077ff4 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 @@ -425,8 +425,9 @@ def list_entities( # type: (...) -> ItemPaged[TableEntity] """Lists entities in a table. - :keyword int results_per_page: Number of entities per page in return ItemPaged + :keyword int results_per_page: Number of entities per page in returned ItemPaged :keyword select: Specify desired properties of an entity to return certain entities + :keywork entity_hook: Callable for custom deserialization :paramtype select: str or list[str] :return: Query of table entities :rtype: ~azure.core.paging.ItemPaged[~azure.data.tables.TableEntity] @@ -441,6 +442,11 @@ def list_entities( :dedent: 8 :caption: List all entities held within a table """ + entity_hook = kwargs.pop('entity_hook', None) + page_iterator_class = TableEntityPropertiesPaged + if entity_hook: + page_iterator_class = functools.partial(TableEntityPropertiesPaged, entity_hook=entity_hook) + user_select = kwargs.pop("select", None) if user_select and not isinstance(user_select, str): user_select = ", ".join(user_select) @@ -452,7 +458,7 @@ def list_entities( table=self.table_name, results_per_page=top, select=user_select, - page_iterator_class=TableEntityPropertiesPaged, + page_iterator_class=page_iterator_class, ) @distributed_trace @@ -467,6 +473,7 @@ def query_entities( :param str filter: Specify a filter to return certain entities :keyword int results_per_page: Number of entities per page in return ItemPaged :keyword select: Specify desired properties of an entity to return certain entities + :keywork entity_hook: Callable for custom deserialization :paramtype select: str or list[str] :keyword dict parameters: Dictionary for formatting query with additional, user defined parameters :return: Query of table entities @@ -482,6 +489,11 @@ def query_entities( :dedent: 8 :caption: Query entities held within a table """ + entity_hook = kwargs.pop("entity_hook", None) + page_iterator_class = TableEntityPropertiesPaged + if entity_hook: + page_iterator_class = functools.partial(TableEntityPropertiesPaged, entity_hook=entity_hook) + parameters = kwargs.pop("parameters", None) filter = self._parameter_filter_substitution( parameters, filter @@ -498,7 +510,7 @@ def query_entities( results_per_page=top, filter=filter, select=user_select, - page_iterator_class=TableEntityPropertiesPaged, + page_iterator_class=page_iterator_class, ) @distributed_trace @@ -528,6 +540,7 @@ def get_entity( :dedent: 8 :caption: Get a single entity from a table """ + entity_hook = kwargs.pop('entity_hook', None) try: entity = self._client.table.query_entity_with_partition_and_row_key( table=self.table_name, @@ -535,6 +548,8 @@ def get_entity( row_key=row_key, **kwargs ) + if entity_hook: + return entity_hook(entity) properties = _convert_to_entity(entity) return properties diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity.yaml new file mode 100644 index 000000000000..4cd4c40168aa --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity.yaml @@ -0,0 +1,186 @@ +interactions: +- request: + body: '{"TableName": "uttable27de0f9b"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 14:07:38 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 14:07:38 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable27de0f9b"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Tue, 26 Jan 2021 14:07:36 GMT + location: + - https://fake_table_account.table.core.windows.net/Tables('uttable27de0f9b') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", + "Birthday@odata.type": "Edm.String"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '195' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 14:07:39 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 14:07:39 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/uttable27de0f9b + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable27de0f9b/@Element","odata.etag":"W/\"datetime''2021-01-26T14%3A07%3A37.6093075Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T14:07:37.6093075Z","Birthday":"2020-01-01T12:59:59.0123456Z"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Tue, 26 Jan 2021 14:07:36 GMT + etag: + - W/"datetime'2021-01-26T14%3A07%3A37.6093075Z'" + location: + - https://fake_table_account.table.core.windows.net/uttable27de0f9b(PartitionKey='pk',RowKey='rk') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 14:07:39 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 14:07:39 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_table_account.table.core.windows.net/uttable27de0f9b(PartitionKey='pk',RowKey='rk') + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable27de0f9b/@Element","odata.etag":"W/\"datetime''2021-01-26T14%3A07%3A37.6093075Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T14:07:37.6093075Z","Birthday":"2020-01-01T12:59:59.0123456Z"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Tue, 26 Jan 2021 14:07:36 GMT + etag: + - W/"datetime'2021-01-26T14%3A07%3A37.6093075Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Tue, 26 Jan 2021 14:07:39 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 14:07:39 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/Tables('uttable27de0f9b') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 26 Jan 2021 14:07:37 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_list.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_list.yaml new file mode 100644 index 000000000000..0a23b98a14d1 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_list.yaml @@ -0,0 +1,236 @@ +interactions: +- request: + body: '{"TableName": "uttable7c0511b6"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 14:07:40 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 14:07:40 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable7c0511b6"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Tue, 26 Jan 2021 14:07:38 GMT + location: + - https://fake_table_account.table.core.windows.net/Tables('uttable7c0511b6') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", + "Birthday@odata.type": "Edm.String"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '195' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 14:07:40 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 14:07:40 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/uttable7c0511b6 + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable7c0511b6/@Element","odata.etag":"W/\"datetime''2021-01-26T14%3A07%3A39.1838738Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T14:07:39.1838738Z","Birthday":"2020-01-01T12:59:59.0123456Z"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Tue, 26 Jan 2021 14:07:39 GMT + etag: + - W/"datetime'2021-01-26T14%3A07%3A39.1838738Z'" + location: + - https://fake_table_account.table.core.windows.net/uttable7c0511b6(PartitionKey='pk',RowKey='rk') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk1", "RowKey@odata.type": "Edm.String", "Birthday": "2021-02-02T12:59:59.0123456Z", + "Birthday@odata.type": "Edm.String"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '196' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 14:07:41 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 14:07:41 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/uttable7c0511b6 + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable7c0511b6/@Element","odata.etag":"W/\"datetime''2021-01-26T14%3A07%3A39.3700053Z''\"","PartitionKey":"pk","RowKey":"rk1","Timestamp":"2021-01-26T14:07:39.3700053Z","Birthday":"2021-02-02T12:59:59.0123456Z"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Tue, 26 Jan 2021 14:07:39 GMT + etag: + - W/"datetime'2021-01-26T14%3A07%3A39.3700053Z'" + location: + - https://fake_table_account.table.core.windows.net/uttable7c0511b6(PartitionKey='pk',RowKey='rk1') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 14:07:41 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 14:07:41 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_table_account.table.core.windows.net/uttable7c0511b6() + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable7c0511b6","value":[{"odata.etag":"W/\"datetime''2021-01-26T14%3A07%3A39.1838738Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T14:07:39.1838738Z","Birthday":"2020-01-01T12:59:59.0123456Z"},{"odata.etag":"W/\"datetime''2021-01-26T14%3A07%3A39.3700053Z''\"","PartitionKey":"pk","RowKey":"rk1","Timestamp":"2021-01-26T14:07:39.3700053Z","Birthday":"2021-02-02T12:59:59.0123456Z"}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Tue, 26 Jan 2021 14:07:39 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Tue, 26 Jan 2021 14:07:41 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 14:07:41 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/Tables('uttable7c0511b6') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 26 Jan 2021 14:07:39 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_query.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_query.yaml new file mode 100644 index 000000000000..f0d4faae14ad --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_query.yaml @@ -0,0 +1,236 @@ +interactions: +- request: + body: '{"TableName": "uttable8e4f1230"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 14:07:42 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 14:07:42 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable8e4f1230"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Tue, 26 Jan 2021 14:07:40 GMT + location: + - https://fake_table_account.table.core.windows.net/Tables('uttable8e4f1230') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", + "Birthday@odata.type": "Edm.String", "Value": 20}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '208' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 14:07:42 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 14:07:42 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/uttable8e4f1230 + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable8e4f1230/@Element","odata.etag":"W/\"datetime''2021-01-26T14%3A07%3A41.0248425Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T14:07:41.0248425Z","Birthday":"2020-01-01T12:59:59.0123456Z","Value":20}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Tue, 26 Jan 2021 14:07:40 GMT + etag: + - W/"datetime'2021-01-26T14%3A07%3A41.0248425Z'" + location: + - https://fake_table_account.table.core.windows.net/uttable8e4f1230(PartitionKey='pk',RowKey='rk') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk1", "RowKey@odata.type": "Edm.String", "Birthday": "2021-02-02T12:59:59.0123456Z", + "Birthday@odata.type": "Edm.String", "Value": 30}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '209' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 14:07:42 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 14:07:42 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/uttable8e4f1230 + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable8e4f1230/@Element","odata.etag":"W/\"datetime''2021-01-26T14%3A07%3A41.1539343Z''\"","PartitionKey":"pk","RowKey":"rk1","Timestamp":"2021-01-26T14:07:41.1539343Z","Birthday":"2021-02-02T12:59:59.0123456Z","Value":30}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Tue, 26 Jan 2021 14:07:41 GMT + etag: + - W/"datetime'2021-01-26T14%3A07%3A41.1539343Z'" + location: + - https://fake_table_account.table.core.windows.net/uttable8e4f1230(PartitionKey='pk',RowKey='rk1') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 14:07:42 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 14:07:42 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_table_account.table.core.windows.net/uttable8e4f1230()?$filter=Value%20lt%2025 + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable8e4f1230","value":[{"odata.etag":"W/\"datetime''2021-01-26T14%3A07%3A41.0248425Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T14:07:41.0248425Z","Birthday":"2020-01-01T12:59:59.0123456Z","Value":20}]}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Tue, 26 Jan 2021 14:07:41 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Tue, 26 Jan 2021 14:07:43 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 14:07:43 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/Tables('uttable8e4f1230') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 26 Jan 2021 14:07:41 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/test_custom_entity.py b/sdk/tables/azure-data-tables/tests/test_custom_entity.py new file mode 100644 index 000000000000..21d2dc0c0d74 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/test_custom_entity.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import pytest + +from base64 import b64encode +from datetime import datetime, timedelta +from dateutil.tz import tzutc, tzoffset +from enum import Enum +from math import isnan +import uuid + +from azure.data.tables import ( + TableServiceClient, + TableClient, + generate_table_sas, + TableEntity, + EntityProperty, + EdmType, + TableSasPermissions, + AccessPolicy, + UpdateMode +) + +from azure.core import MatchConditions +from azure.core.exceptions import ( + HttpResponseError, + ResourceNotFoundError, + ResourceExistsError, + ResourceModifiedError, +) + +from _shared.testcase import TableTestCase +from preparers import TablesPreparer + +# ------------------------------------------------------------------------------ +from datetime import datetime + +class MyEntity(object): + + def __init__(self, entry_element): + self.properties = {} + self.partition_key = entry_element.pop("PartitionKey") + self.row_key = entry_element.pop("RowKey") + self.timestamp = entry_element.pop("Timestamp") + + properties = {} + edmtypes = {} + odata = {} + + for name, value in entry_element.items(): + if name.startswith("odata."): + odata[name[6:]] = value + elif name.endswith("@odata.type"): + edmtypes[name[:-11]] = value + else: + properties[name] = value + + for name, value in properties.items(): + mtype = edmtypes.get(name) + + # Use Simple Ints + if type(value) is int and mtype in [EdmType.INT32, EdmType.INT64]: + self.properties[name] = int(value) + continue + + # Add type for String + try: + if type(value) is unicode and mtype is None: + self.properties[name] = unicode(value) + continue + except NameError: + if type(value) is str and mtype is None: # pylint:disable=C0123 + self.properties[name] = str(value) + continue + + self.properties[name] = value + + self.convert_birthdays() + + def convert_birthdays(self): + if 'birthday' in self.properties.keys(): + self.properties['birthday'], self.properties['milliseconds'] = self._convert_date(self.properties['birthday']) + if 'Birthday' in self.properties.keys(): + self.properties['Birthday'], self.properties['milliseconds'] = self._convert_date(self.properties['Birthday']) + + def _convert_date(self, bday): + if 'Z' in bday: + # Has milliseconds, we'll handle this separately + # Python library only handles 6 decimal places of precision + ms = bday.split('.')[-1] + ms = '.' + ms[:-1] + ms = float(ms) + date = bday.split('.')[0] + date = datetime.strptime(date, "%Y-%m-%dT%H:%M:%S") + return date, ms + else: + return datetime.strptime(date, "%Y-%m-%dT%H:%M:%S"), 0.0 + + def keys(self): + return self.properties.keys() + +def modify_returned_class(entity): + if 'birthday' in entity.keys(): + bday = entity['birthday'] + if 'Z' in bday: + ms = bday.split(':')[-1] + ms = '.' + ms + ms = float(ms) + date = bday.replace(str(ms), '') + date = datetime.strptime(date, "%Y-%m-%dT%H:%M") + entity['birthday'] = date + entity['birthday_ms'] = ms + if 'Birthday' in entity.keys(): + bday = entity['birthday'] + if 'Z' in bday: + ms = bday.split(':')[-1] + ms = '.' + ms + ms = float(ms) + date = bday.replace(str(ms), '') + date = datetime.strptime(date, "%Y-%m-%dT%H:%M") + entity['Birthday'] = date + entity['Birthday_ms'] = ms + + return entity + + +class StorageTableEntityTest(TableTestCase): + + def _set_up(self, tables_storage_account_name, tables_primary_storage_account_key, url='table'): + table_name = self.get_resource_name('uttable') + ts = TableServiceClient( + self.account_url(tables_storage_account_name, url), + credential=tables_primary_storage_account_key, + table_name=table_name + ) + table = ts.get_table_client(table_name) + if self.is_live: + try: + ts.create_table(table_name) + except ResourceExistsError: + pass + return table + + def _tear_down(self, tables_storage_account_name, tables_primary_storage_account_key, url='table'): + table_name = self.get_resource_name('uttable') + ts = TableServiceClient( + self.account_url(tables_storage_account_name, url), + credential=tables_primary_storage_account_key, + table_name=table_name + ) + if self.is_live: + try: + ts.delete_table(table_name) + except: + pass + + + @TablesPreparer() + def test_custom_entity(self, tables_storage_account_name, tables_primary_storage_account_key): + table_client = self._set_up(tables_storage_account_name, tables_primary_storage_account_key) + + entity = { + u"PartitionKey": u"pk", + u"RowKey": u"rk", + u"Birthday": u"2020-01-01T12:59:59.0123456Z" + } + try: + with table_client as tc: + tc.create_entity(entity) + entity = tc.get_entity( + partition_key=entity[u'PartitionKey'], + row_key=entity[u'RowKey'], + entity_hook=MyEntity + ) + + assert isinstance(entity.properties['Birthday'], datetime) + assert 'milliseconds' in entity.keys() + assert entity.properties['milliseconds'] == .0123456 + assert entity.properties['Birthday'] == datetime(2020, 1, 1, 12, 59, 59) + + finally: + self._tear_down(tables_storage_account_name, tables_primary_storage_account_key) + + + @TablesPreparer() + def test_custom_entity_list(self, tables_storage_account_name, tables_primary_storage_account_key): + table_client = self._set_up(tables_storage_account_name, tables_primary_storage_account_key) + + entity = { + u"PartitionKey": u"pk", + u"RowKey": u"rk", + u"Birthday": u"2020-01-01T12:59:59.0123456Z" + } + entity2 = { + u"PartitionKey": u"pk", + u"RowKey": u"rk1", + u"Birthday": u"2021-02-02T12:59:59.0123456Z" + } + try: + with table_client as tc: + tc.create_entity(entity) + tc.create_entity(entity2) + entities = tc.list_entities( + entity_hook=MyEntity + ) + + length = 0 + for entity in entities: + assert isinstance(entity.properties['Birthday'], datetime) + assert 'milliseconds' in entity.keys() + assert entity.properties['milliseconds'] == .0123456 + # assert entity.properties['Birthday'] == datetime(2020, 1, 1, 12, 59, 59) + length += 1 + assert length == 2 + + finally: + self._tear_down(tables_storage_account_name, tables_primary_storage_account_key) + + + @TablesPreparer() + def test_custom_entity_query(self, tables_storage_account_name, tables_primary_storage_account_key): + table_client = self._set_up(tables_storage_account_name, tables_primary_storage_account_key) + + entity = { + u"PartitionKey": u"pk", + u"RowKey": u"rk", + u"Birthday": u"2020-01-01T12:59:59.0123456Z", + u"Value": 20 + } + entity2 = { + u"PartitionKey": u"pk", + u"RowKey": u"rk1", + u"Birthday": u"2021-02-02T12:59:59.0123456Z", + u"Value": 30 + } + try: + with table_client as tc: + tc.create_entity(entity) + tc.create_entity(entity2) + + f = "Value lt @value" + params = { + "value": 25 + } + entities = tc.query_entities( + filter=f, + parameters=params, + entity_hook=MyEntity + ) + + length = 0 + for entity in entities: + assert isinstance(entity.properties['Birthday'], datetime) + assert 'milliseconds' in entity.keys() + assert entity.properties['milliseconds'] == .0123456 + # assert entity.properties['Birthday'] == datetime(2020, 1, 1, 12, 59, 59) + length += 1 + assert length == 1 + + finally: + self._tear_down(tables_storage_account_name, tables_primary_storage_account_key) \ No newline at end of file From 16688722aa4b9a9e78fc0e2a377de531551ef2ab Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Tue, 26 Jan 2021 10:55:19 -0500 Subject: [PATCH 2/7] added custom entity for async --- .../azure/data/tables/_models.py | 11 +- .../azure/data/tables/aio/_models.py | 5 +- .../data/tables/aio/_table_client_async.py | 20 +- ...test_custom_entity.test_custom_entity.yaml | 90 ++-- ...custom_entity.test_custom_entity_list.yaml | 112 ++--- ...ustom_entity.test_custom_entity_query.yaml | 112 ++--- ...ustom_entity_async.test_custom_entity.yaml | 130 ++++++ ..._entity_async.test_custom_entity_list.yaml | 166 ++++++++ ...entity_async.test_custom_entity_query.yaml | 166 ++++++++ .../tests/test_custom_entity.py | 143 ++++++- .../tests/test_custom_entity_async.py | 390 ++++++++++++++++++ 11 files changed, 1135 insertions(+), 210 deletions(-) create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_list.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_query.yaml create mode 100644 sdk/tables/azure-data-tables/tests/test_custom_entity_async.py 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 063e35e83848..292a845abdf4 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_models.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_models.py @@ -323,7 +323,7 @@ class TableEntityPropertiesPaged(PageIterator): :keyword str continuation_token: An opaque continuation token. :keyword str location_mode: The location mode being used to list results. The available options include "primary" and "secondary". - :keyword callabel entity_hook: A custom entity type for deserialization entities returned + :keyword callable entity_hook: A custom entity type for deserialization entities returned from the service """ @@ -341,7 +341,7 @@ def __init__(self, command, table, **kwargs): self.filter = kwargs.get("filter") self.select = kwargs.get("select") self.location_mode = None - self.entity_hook = kwargs.get("entity_hook", None) + self.entity_hook = kwargs.pop("entity_hook", _convert_to_entity) def _get_next_cb(self, continuation_token, **kwargs): next_partition_key, next_row_key = _extract_continuation_token( @@ -362,14 +362,9 @@ def _get_next_cb(self, continuation_token, **kwargs): except HttpResponseError as error: _process_table_error(error) - def _get_props_list(self): - if self.entity_hook: - return [self.entity_hook(t) for t in self._response.value] - return [_convert_to_entity(t) for t in self._response.value] - def _extract_data_cb(self, get_next_return): self.location_mode, self._response, self._headers = get_next_return - props_list = self._get_props_list() + props_list = [self.entity_hook(t) for t in self._response.value] #self._get_props_list() next_entity = {} if self._headers[NEXT_PARTITION_KEY] or self._headers[NEXT_ROW_KEY]: next_entity = { diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py index 071a1c7a4b48..258ce56d31cb 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py @@ -76,6 +76,8 @@ class TableEntityPropertiesPaged(AsyncPageIterator): :keyword str continuation_token: An opaque continuation token. :keyword str location_mode: The location mode being used to list results. The available options include "primary" and "secondary". + :keyword callable entity_hook: A custom entity type for deserialization entities returned + from the service """ def __init__(self, command, table, **kwargs): @@ -92,6 +94,7 @@ def __init__(self, command, table, **kwargs): self.filter = kwargs.get("filter") self.select = kwargs.get("select") self.location_mode = None + self.entity_hook = kwargs.pop("entity_hook", _convert_to_entity) async def _get_next_cb(self, continuation_token, **kwargs): next_partition_key, next_row_key = _extract_continuation_token( @@ -114,7 +117,7 @@ async def _get_next_cb(self, continuation_token, **kwargs): async def _extract_data_cb(self, get_next_return): self.location_mode, self._response, self._headers = get_next_return - props_list = [_convert_to_entity(t) for t in self._response.value] + props_list = [self.entity_hook(t) for t in self._response.value] next_entity = {} if self._headers[NEXT_PARTITION_KEY] or self._headers[NEXT_ROW_KEY]: next_entity = { 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 1d75e5cdf274..95e93441302f 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 @@ -445,6 +445,7 @@ def list_entities( :keyword int results_per_page: Number of entities per page in return AsyncItemPaged :keyword select: Specify desired properties of an entity to return certain entities + :keywork entity_hook: Callable for custom deserialization :paramtype select: str or list[str] :return: Query of table entities :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.data.tables.TableEntity] @@ -459,6 +460,11 @@ def list_entities( :dedent: 8 :caption: Querying entities from a TableClient """ + entity_hook = kwargs.pop('entity_hook', None) + page_iterator_class = TableEntityPropertiesPaged + if entity_hook: + page_iterator_class = functools.partial(TableEntityPropertiesPaged, entity_hook=entity_hook) + user_select = kwargs.pop("select", None) if user_select and not isinstance(user_select, str): user_select = ", ".join(user_select) @@ -470,7 +476,7 @@ def list_entities( table=self.table_name, results_per_page=top, select=user_select, - page_iterator_class=TableEntityPropertiesPaged, + page_iterator_class=page_iterator_class, ) @distributed_trace @@ -485,6 +491,7 @@ def query_entities( :param str filter: Specify a filter to return certain entities :keyword int results_per_page: Number of entities per page in return AsyncItemPaged :keyword select: Specify desired properties of an entity to return certain entities + :keywork entity_hook: Callable for custom deserialization :paramtype select: str or list[str] :keyword dict parameters: Dictionary for formatting query with additional, user defined parameters :return: Query of table entities @@ -500,6 +507,11 @@ def query_entities( :dedent: 8 :caption: Querying entities from a TableClient """ + entity_hook = kwargs.pop("entity_hook", None) + page_iterator_class = TableEntityPropertiesPaged + if entity_hook: + page_iterator_class = functools.partial(TableEntityPropertiesPaged, entity_hook=entity_hook) + parameters = kwargs.pop("parameters", None) filter = self._parameter_filter_substitution( parameters, filter @@ -516,7 +528,7 @@ def query_entities( results_per_page=top, filter=filter, select=user_select, - page_iterator_class=TableEntityPropertiesPaged, + page_iterator_class=page_iterator_class, ) @distributed_trace_async @@ -534,6 +546,7 @@ async def get_entity( :param row_key: The row key of the entity. :type row_key: str :return: Dictionary mapping operation metadata returned from the service + :keywork entity_hook: Callable for custom deserialization :rtype: ~azure.data.tables.TableEntity :raises ~azure.core.exceptions.HttpResponseError: @@ -546,6 +559,7 @@ async def get_entity( :dedent: 8 :caption: Getting an entity from PartitionKey and RowKey """ + entity_hook = kwargs.pop('entity_hook', None) try: entity = await self._client.table.query_entity_with_partition_and_row_key( table=self.table_name, @@ -553,6 +567,8 @@ async def get_entity( row_key=row_key, **kwargs ) + if entity_hook: + return entity_hook(entity) properties = _convert_to_entity(entity) return properties diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity.yaml index 4cd4c40168aa..a788d6513792 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity.yaml @@ -15,38 +15,34 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 14:07:38 GMT + - Tue, 26 Jan 2021 15:35:46 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 14:07:38 GMT + - Tue, 26 Jan 2021 15:35:46 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_table_account.table.core.windows.net/Tables + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables response: body: - string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable27de0f9b"}' + string: '{"TableName":"uttable27de0f9b","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' headers: - cache-control: - - no-cache content-type: - - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + - application/json;odata=minimalmetadata date: - - Tue, 26 Jan 2021 14:07:36 GMT + - Tue, 26 Jan 2021 15:35:45 GMT + etag: + - W/"datetime'2021-01-26T15%3A35%3A45.3529096Z'" location: - - https://fake_table_account.table.core.windows.net/Tables('uttable27de0f9b') + - https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable27de0f9b') server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked - x-content-type-options: - - nosniff - x-ms-version: - - '2019-02-02' status: code: 201 - message: Created + message: Ok - request: body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", @@ -65,37 +61,31 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 14:07:39 GMT + - Tue, 26 Jan 2021 15:35:47 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 14:07:39 GMT + - Tue, 26 Jan 2021 15:35:47 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_table_account.table.core.windows.net/uttable27de0f9b + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable27de0f9b response: body: - string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable27de0f9b/@Element","odata.etag":"W/\"datetime''2021-01-26T14%3A07%3A37.6093075Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T14:07:37.6093075Z","Birthday":"2020-01-01T12:59:59.0123456Z"}' + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable27de0f9b/$metadata#uttable27de0f9b/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A35%3A45.9355656Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T15:35:45.9355656Z"}' headers: - cache-control: - - no-cache content-type: - - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + - application/json;odata=minimalmetadata date: - - Tue, 26 Jan 2021 14:07:36 GMT + - Tue, 26 Jan 2021 15:35:45 GMT etag: - - W/"datetime'2021-01-26T14%3A07%3A37.6093075Z'" + - W/"datetime'2021-01-26T15%3A35%3A45.9355656Z'" location: - - https://fake_table_account.table.core.windows.net/uttable27de0f9b(PartitionKey='pk',RowKey='rk') + - https://fake_cosmos_account.table.cosmos.azure.com/uttable27de0f9b(PartitionKey='pk',RowKey='rk') server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked - x-content-type-options: - - nosniff - x-ms-version: - - '2019-02-02' status: code: 201 message: Created @@ -111,38 +101,32 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 14:07:39 GMT + - Tue, 26 Jan 2021 15:35:47 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 14:07:39 GMT + - Tue, 26 Jan 2021 15:35:47 GMT x-ms-version: - '2019-02-02' method: GET - uri: https://fake_table_account.table.core.windows.net/uttable27de0f9b(PartitionKey='pk',RowKey='rk') + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable27de0f9b(PartitionKey='pk',RowKey='rk') response: body: - string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable27de0f9b/@Element","odata.etag":"W/\"datetime''2021-01-26T14%3A07%3A37.6093075Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T14:07:37.6093075Z","Birthday":"2020-01-01T12:59:59.0123456Z"}' + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable27de0f9b/$metadata#uttable27de0f9b/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A35%3A45.9355656Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T15:35:45.9355656Z"}' headers: - cache-control: - - no-cache content-type: - - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + - application/json;odata=minimalmetadata date: - - Tue, 26 Jan 2021 14:07:36 GMT + - Tue, 26 Jan 2021 15:35:45 GMT etag: - - W/"datetime'2021-01-26T14%3A07%3A37.6093075Z'" + - W/"datetime'2021-01-26T15%3A35%3A45.9355656Z'" server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked - x-content-type-options: - - nosniff - x-ms-version: - - '2019-02-02' status: code: 200 - message: OK + message: Ok - request: body: null headers: @@ -155,31 +139,25 @@ interactions: Content-Length: - '0' Date: - - Tue, 26 Jan 2021 14:07:39 GMT + - Tue, 26 Jan 2021 15:35:47 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 14:07:39 GMT + - Tue, 26 Jan 2021 15:35:47 GMT x-ms-version: - '2019-02-02' method: DELETE - uri: https://fake_table_account.table.core.windows.net/Tables('uttable27de0f9b') + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable27de0f9b') response: body: string: '' headers: - cache-control: - - no-cache content-length: - '0' date: - - Tue, 26 Jan 2021 14:07:37 GMT + - Tue, 26 Jan 2021 15:35:46 GMT server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - x-content-type-options: - - nosniff - x-ms-version: - - '2019-02-02' + - Microsoft-HTTPAPI/2.0 status: code: 204 message: No Content diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_list.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_list.yaml index 0a23b98a14d1..9ef05098467b 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_list.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_list.yaml @@ -15,38 +15,34 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 14:07:40 GMT + - Tue, 26 Jan 2021 15:36:18 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 14:07:40 GMT + - Tue, 26 Jan 2021 15:36:18 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_table_account.table.core.windows.net/Tables + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables response: body: - string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable7c0511b6"}' + string: '{"TableName":"uttable7c0511b6","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' headers: - cache-control: - - no-cache content-type: - - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + - application/json;odata=minimalmetadata date: - - Tue, 26 Jan 2021 14:07:38 GMT + - Tue, 26 Jan 2021 15:36:17 GMT + etag: + - W/"datetime'2021-01-26T15%3A36%3A17.8428936Z'" location: - - https://fake_table_account.table.core.windows.net/Tables('uttable7c0511b6') + - https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable7c0511b6') server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked - x-content-type-options: - - nosniff - x-ms-version: - - '2019-02-02' status: code: 201 - message: Created + message: Ok - request: body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", @@ -65,37 +61,31 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 14:07:40 GMT + - Tue, 26 Jan 2021 15:36:20 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 14:07:40 GMT + - Tue, 26 Jan 2021 15:36:20 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_table_account.table.core.windows.net/uttable7c0511b6 + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable7c0511b6 response: body: - string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable7c0511b6/@Element","odata.etag":"W/\"datetime''2021-01-26T14%3A07%3A39.1838738Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T14:07:39.1838738Z","Birthday":"2020-01-01T12:59:59.0123456Z"}' + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable7c0511b6/$metadata#uttable7c0511b6/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A36%3A18.4824840Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T15:36:18.4824840Z"}' headers: - cache-control: - - no-cache content-type: - - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + - application/json;odata=minimalmetadata date: - - Tue, 26 Jan 2021 14:07:39 GMT + - Tue, 26 Jan 2021 15:36:18 GMT etag: - - W/"datetime'2021-01-26T14%3A07%3A39.1838738Z'" + - W/"datetime'2021-01-26T15%3A36%3A18.4824840Z'" location: - - https://fake_table_account.table.core.windows.net/uttable7c0511b6(PartitionKey='pk',RowKey='rk') + - https://fake_cosmos_account.table.cosmos.azure.com/uttable7c0511b6(PartitionKey='pk',RowKey='rk') server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked - x-content-type-options: - - nosniff - x-ms-version: - - '2019-02-02' status: code: 201 message: Created @@ -117,37 +107,31 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 14:07:41 GMT + - Tue, 26 Jan 2021 15:36:20 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 14:07:41 GMT + - Tue, 26 Jan 2021 15:36:20 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_table_account.table.core.windows.net/uttable7c0511b6 + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable7c0511b6 response: body: - string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable7c0511b6/@Element","odata.etag":"W/\"datetime''2021-01-26T14%3A07%3A39.3700053Z''\"","PartitionKey":"pk","RowKey":"rk1","Timestamp":"2021-01-26T14:07:39.3700053Z","Birthday":"2021-02-02T12:59:59.0123456Z"}' + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable7c0511b6/$metadata#uttable7c0511b6/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A36%3A18.6268680Z''\"","PartitionKey":"pk","RowKey":"rk1","Birthday":"2021-02-02T12:59:59.0123456Z","Timestamp":"2021-01-26T15:36:18.6268680Z"}' headers: - cache-control: - - no-cache content-type: - - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + - application/json;odata=minimalmetadata date: - - Tue, 26 Jan 2021 14:07:39 GMT + - Tue, 26 Jan 2021 15:36:18 GMT etag: - - W/"datetime'2021-01-26T14%3A07%3A39.3700053Z'" + - W/"datetime'2021-01-26T15%3A36%3A18.6268680Z'" location: - - https://fake_table_account.table.core.windows.net/uttable7c0511b6(PartitionKey='pk',RowKey='rk1') + - https://fake_cosmos_account.table.cosmos.azure.com/uttable7c0511b6(PartitionKey='pk',RowKey='rk1') server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked - x-content-type-options: - - nosniff - x-ms-version: - - '2019-02-02' status: code: 201 message: Created @@ -163,36 +147,30 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 14:07:41 GMT + - Tue, 26 Jan 2021 15:36:20 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 14:07:41 GMT + - Tue, 26 Jan 2021 15:36:20 GMT x-ms-version: - '2019-02-02' method: GET - uri: https://fake_table_account.table.core.windows.net/uttable7c0511b6() + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable7c0511b6() response: body: - string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable7c0511b6","value":[{"odata.etag":"W/\"datetime''2021-01-26T14%3A07%3A39.1838738Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T14:07:39.1838738Z","Birthday":"2020-01-01T12:59:59.0123456Z"},{"odata.etag":"W/\"datetime''2021-01-26T14%3A07%3A39.3700053Z''\"","PartitionKey":"pk","RowKey":"rk1","Timestamp":"2021-01-26T14:07:39.3700053Z","Birthday":"2021-02-02T12:59:59.0123456Z"}]}' + string: '{"value":[{"odata.etag":"W/\"datetime''2021-01-26T15%3A36%3A18.4824840Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T15:36:18.4824840Z"},{"odata.etag":"W/\"datetime''2021-01-26T15%3A36%3A18.6268680Z''\"","PartitionKey":"pk","RowKey":"rk1","Birthday":"2021-02-02T12:59:59.0123456Z","Timestamp":"2021-01-26T15:36:18.6268680Z"}],"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#uttable7c0511b6"}' headers: - cache-control: - - no-cache content-type: - - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + - application/json;odata=minimalmetadata date: - - Tue, 26 Jan 2021 14:07:39 GMT + - Tue, 26 Jan 2021 15:36:18 GMT server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked - x-content-type-options: - - nosniff - x-ms-version: - - '2019-02-02' status: code: 200 - message: OK + message: Ok - request: body: null headers: @@ -205,31 +183,25 @@ interactions: Content-Length: - '0' Date: - - Tue, 26 Jan 2021 14:07:41 GMT + - Tue, 26 Jan 2021 15:36:20 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 14:07:41 GMT + - Tue, 26 Jan 2021 15:36:20 GMT x-ms-version: - '2019-02-02' method: DELETE - uri: https://fake_table_account.table.core.windows.net/Tables('uttable7c0511b6') + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable7c0511b6') response: body: string: '' headers: - cache-control: - - no-cache content-length: - '0' date: - - Tue, 26 Jan 2021 14:07:39 GMT + - Tue, 26 Jan 2021 15:36:19 GMT server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - x-content-type-options: - - nosniff - x-ms-version: - - '2019-02-02' + - Microsoft-HTTPAPI/2.0 status: code: 204 message: No Content diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_query.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_query.yaml index f0d4faae14ad..5e8ab3d5420e 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_query.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_query.yaml @@ -15,38 +15,34 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 14:07:42 GMT + - Tue, 26 Jan 2021 15:36:51 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 14:07:42 GMT + - Tue, 26 Jan 2021 15:36:51 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_table_account.table.core.windows.net/Tables + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables response: body: - string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable8e4f1230"}' + string: '{"TableName":"uttable8e4f1230","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' headers: - cache-control: - - no-cache content-type: - - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + - application/json;odata=minimalmetadata date: - - Tue, 26 Jan 2021 14:07:40 GMT + - Tue, 26 Jan 2021 15:36:50 GMT + etag: + - W/"datetime'2021-01-26T15%3A36%3A51.1646728Z'" location: - - https://fake_table_account.table.core.windows.net/Tables('uttable8e4f1230') + - https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable8e4f1230') server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked - x-content-type-options: - - nosniff - x-ms-version: - - '2019-02-02' status: code: 201 - message: Created + message: Ok - request: body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", @@ -65,37 +61,31 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 14:07:42 GMT + - Tue, 26 Jan 2021 15:36:53 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 14:07:42 GMT + - Tue, 26 Jan 2021 15:36:53 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_table_account.table.core.windows.net/uttable8e4f1230 + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable8e4f1230 response: body: - string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable8e4f1230/@Element","odata.etag":"W/\"datetime''2021-01-26T14%3A07%3A41.0248425Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T14:07:41.0248425Z","Birthday":"2020-01-01T12:59:59.0123456Z","Value":20}' + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable8e4f1230/$metadata#uttable8e4f1230/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A36%3A51.8670344Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Value":20,"Timestamp":"2021-01-26T15:36:51.8670344Z"}' headers: - cache-control: - - no-cache content-type: - - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + - application/json;odata=minimalmetadata date: - - Tue, 26 Jan 2021 14:07:40 GMT + - Tue, 26 Jan 2021 15:36:51 GMT etag: - - W/"datetime'2021-01-26T14%3A07%3A41.0248425Z'" + - W/"datetime'2021-01-26T15%3A36%3A51.8670344Z'" location: - - https://fake_table_account.table.core.windows.net/uttable8e4f1230(PartitionKey='pk',RowKey='rk') + - https://fake_cosmos_account.table.cosmos.azure.com/uttable8e4f1230(PartitionKey='pk',RowKey='rk') server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked - x-content-type-options: - - nosniff - x-ms-version: - - '2019-02-02' status: code: 201 message: Created @@ -117,37 +107,31 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 14:07:42 GMT + - Tue, 26 Jan 2021 15:36:53 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 14:07:42 GMT + - Tue, 26 Jan 2021 15:36:53 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_table_account.table.core.windows.net/uttable8e4f1230 + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable8e4f1230 response: body: - string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable8e4f1230/@Element","odata.etag":"W/\"datetime''2021-01-26T14%3A07%3A41.1539343Z''\"","PartitionKey":"pk","RowKey":"rk1","Timestamp":"2021-01-26T14:07:41.1539343Z","Birthday":"2021-02-02T12:59:59.0123456Z","Value":30}' + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable8e4f1230/$metadata#uttable8e4f1230/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A36%3A52.0079368Z''\"","PartitionKey":"pk","RowKey":"rk1","Birthday":"2021-02-02T12:59:59.0123456Z","Value":30,"Timestamp":"2021-01-26T15:36:52.0079368Z"}' headers: - cache-control: - - no-cache content-type: - - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + - application/json;odata=minimalmetadata date: - - Tue, 26 Jan 2021 14:07:41 GMT + - Tue, 26 Jan 2021 15:36:51 GMT etag: - - W/"datetime'2021-01-26T14%3A07%3A41.1539343Z'" + - W/"datetime'2021-01-26T15%3A36%3A52.0079368Z'" location: - - https://fake_table_account.table.core.windows.net/uttable8e4f1230(PartitionKey='pk',RowKey='rk1') + - https://fake_cosmos_account.table.cosmos.azure.com/uttable8e4f1230(PartitionKey='pk',RowKey='rk1') server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked - x-content-type-options: - - nosniff - x-ms-version: - - '2019-02-02' status: code: 201 message: Created @@ -163,36 +147,30 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 14:07:42 GMT + - Tue, 26 Jan 2021 15:36:53 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 14:07:42 GMT + - Tue, 26 Jan 2021 15:36:53 GMT x-ms-version: - '2019-02-02' method: GET - uri: https://fake_table_account.table.core.windows.net/uttable8e4f1230()?$filter=Value%20lt%2025 + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable8e4f1230()?$filter=Value%20lt%2025 response: body: - string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable8e4f1230","value":[{"odata.etag":"W/\"datetime''2021-01-26T14%3A07%3A41.0248425Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T14:07:41.0248425Z","Birthday":"2020-01-01T12:59:59.0123456Z","Value":20}]}' + string: '{"value":[{"odata.etag":"W/\"datetime''2021-01-26T15%3A36%3A51.8670344Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Value":20,"Timestamp":"2021-01-26T15:36:51.8670344Z"}],"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#uttable8e4f1230"}' headers: - cache-control: - - no-cache content-type: - - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + - application/json;odata=minimalmetadata date: - - Tue, 26 Jan 2021 14:07:41 GMT + - Tue, 26 Jan 2021 15:36:51 GMT server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked - x-content-type-options: - - nosniff - x-ms-version: - - '2019-02-02' status: code: 200 - message: OK + message: Ok - request: body: null headers: @@ -205,31 +183,25 @@ interactions: Content-Length: - '0' Date: - - Tue, 26 Jan 2021 14:07:43 GMT + - Tue, 26 Jan 2021 15:36:53 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 14:07:43 GMT + - Tue, 26 Jan 2021 15:36:53 GMT x-ms-version: - '2019-02-02' method: DELETE - uri: https://fake_table_account.table.core.windows.net/Tables('uttable8e4f1230') + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable8e4f1230') response: body: string: '' headers: - cache-control: - - no-cache content-length: - '0' date: - - Tue, 26 Jan 2021 14:07:41 GMT + - Tue, 26 Jan 2021 15:36:52 GMT server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - x-content-type-options: - - nosniff - x-ms-version: - - '2019-02-02' + - Microsoft-HTTPAPI/2.0 status: code: 204 message: No Content diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity.yaml new file mode 100644 index 000000000000..686c8e08d1c0 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity.yaml @@ -0,0 +1,130 @@ +interactions: +- request: + body: '{"TableName": "uttable8e041218"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 15:53:23 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 15:53:23 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + response: + body: + string: '{"TableName":"uttable8e041218","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 15:53:21 GMT + etag: W/"datetime'2021-01-26T15%3A53%3A22.0158472Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable8e041218') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Ok + url: https://seankaneprim.table.cosmos.azure.com/Tables +- request: + body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", + "Birthday@odata.type": "Edm.String"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '195' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 15:53:24 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 15:53:24 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable8e041218 + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable8e041218/$metadata#uttable8e041218/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A53%3A22.6231816Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T15:53:22.6231816Z"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 15:53:21 GMT + etag: W/"datetime'2021-01-26T15%3A53%3A22.6231816Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/uttable8e041218(PartitionKey='pk',RowKey='rk') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://seankaneprim.table.cosmos.azure.com/uttable8e041218 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 15:53:24 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 15:53:24 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable8e041218(PartitionKey='pk',RowKey='rk') + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable8e041218/$metadata#uttable8e041218/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A53%3A22.6231816Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T15:53:22.6231816Z"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 15:53:21 GMT + etag: W/"datetime'2021-01-26T15%3A53%3A22.6231816Z'" + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 200 + message: Ok + url: https://seankaneprim.table.cosmos.azure.com/uttable8e041218(PartitionKey='pk',RowKey='rk') +- request: + body: null + headers: + Accept: + - application/json + Date: + - Tue, 26 Jan 2021 15:53:24 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 15:53:24 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable8e041218') + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 26 Jan 2021 15:53:23 GMT + server: Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content + url: https://seankaneprim.table.cosmos.azure.com/Tables('uttable8e041218') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_list.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_list.yaml new file mode 100644 index 000000000000..3103d4329c70 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_list.yaml @@ -0,0 +1,166 @@ +interactions: +- request: + body: '{"TableName": "uttableee9c1433"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 15:53:55 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 15:53:55 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + response: + body: + string: '{"TableName":"uttableee9c1433","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 15:53:54 GMT + etag: W/"datetime'2021-01-26T15%3A53%3A54.3972872Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttableee9c1433') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Ok + url: https://seankaneprim.table.cosmos.azure.com/Tables +- request: + body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", + "Birthday@odata.type": "Edm.String"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '195' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 15:53:56 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 15:53:56 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttableee9c1433 + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttableee9c1433/$metadata#uttableee9c1433/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A53%3A55.1277064Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T15:53:55.1277064Z"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 15:53:54 GMT + etag: W/"datetime'2021-01-26T15%3A53%3A55.1277064Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/uttableee9c1433(PartitionKey='pk',RowKey='rk') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://seankaneprim.table.cosmos.azure.com/uttableee9c1433 +- request: + body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk1", "RowKey@odata.type": "Edm.String", "Birthday": "2021-02-02T12:59:59.0123456Z", + "Birthday@odata.type": "Edm.String"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '196' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 15:53:56 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 15:53:56 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttableee9c1433 + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttableee9c1433/$metadata#uttableee9c1433/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A53%3A55.2427016Z''\"","PartitionKey":"pk","RowKey":"rk1","Birthday":"2021-02-02T12:59:59.0123456Z","Timestamp":"2021-01-26T15:53:55.2427016Z"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 15:53:54 GMT + etag: W/"datetime'2021-01-26T15%3A53%3A55.2427016Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/uttableee9c1433(PartitionKey='pk',RowKey='rk1') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://seankaneprim.table.cosmos.azure.com/uttableee9c1433 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 15:53:57 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 15:53:57 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttableee9c1433() + response: + body: + string: '{"value":[{"odata.etag":"W/\"datetime''2021-01-26T15%3A53%3A55.1277064Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T15:53:55.1277064Z"},{"odata.etag":"W/\"datetime''2021-01-26T15%3A53%3A55.2427016Z''\"","PartitionKey":"pk","RowKey":"rk1","Birthday":"2021-02-02T12:59:59.0123456Z","Timestamp":"2021-01-26T15:53:55.2427016Z"}],"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#uttableee9c1433"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 15:53:54 GMT + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 200 + message: Ok + url: https://seankaneprim.table.cosmos.azure.com/uttableee9c1433() +- request: + body: null + headers: + Accept: + - application/json + Date: + - Tue, 26 Jan 2021 15:53:57 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 15:53:57 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttableee9c1433') + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 26 Jan 2021 15:53:56 GMT + server: Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content + url: https://seankaneprim.table.cosmos.azure.com/Tables('uttableee9c1433') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_query.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_query.yaml new file mode 100644 index 000000000000..4fc014a24729 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_query.yaml @@ -0,0 +1,166 @@ +interactions: +- request: + body: '{"TableName": "uttable37214ad"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '31' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 15:54:28 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 15:54:28 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + response: + body: + string: '{"TableName":"uttable37214ad","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 15:54:27 GMT + etag: W/"datetime'2021-01-26T15%3A54%3A26.9238280Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable37214ad') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Ok + url: https://seankaneprim.table.cosmos.azure.com/Tables +- request: + body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", + "Birthday@odata.type": "Edm.String", "Value": 20}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '208' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 15:54:29 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 15:54:29 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable37214ad + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable37214ad/$metadata#uttable37214ad/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A54%3A27.7315592Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Value":20,"Timestamp":"2021-01-26T15:54:27.7315592Z"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 15:54:27 GMT + etag: W/"datetime'2021-01-26T15%3A54%3A27.7315592Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/uttable37214ad(PartitionKey='pk',RowKey='rk') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://seankaneprim.table.cosmos.azure.com/uttable37214ad +- request: + body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk1", "RowKey@odata.type": "Edm.String", "Birthday": "2021-02-02T12:59:59.0123456Z", + "Birthday@odata.type": "Edm.String", "Value": 30}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '209' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 15:54:29 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 15:54:29 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable37214ad + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable37214ad/$metadata#uttable37214ad/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A54%3A27.8456328Z''\"","PartitionKey":"pk","RowKey":"rk1","Birthday":"2021-02-02T12:59:59.0123456Z","Value":30,"Timestamp":"2021-01-26T15:54:27.8456328Z"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 15:54:27 GMT + etag: W/"datetime'2021-01-26T15%3A54%3A27.8456328Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/uttable37214ad(PartitionKey='pk',RowKey='rk1') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://seankaneprim.table.cosmos.azure.com/uttable37214ad +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 15:54:29 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 15:54:29 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable37214ad()?$filter=Value%20lt%2025 + response: + body: + string: '{"value":[{"odata.etag":"W/\"datetime''2021-01-26T15%3A54%3A27.7315592Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Value":20,"Timestamp":"2021-01-26T15:54:27.7315592Z"}],"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#uttable37214ad"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 15:54:27 GMT + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 200 + message: Ok + url: https://seankaneprim.table.cosmos.azure.com/uttable37214ad()?$filter=Value%20lt%2025 +- request: + body: null + headers: + Accept: + - application/json + Date: + - Tue, 26 Jan 2021 15:54:29 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 15:54:29 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable37214ad') + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 26 Jan 2021 15:54:28 GMT + server: Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content + url: https://seankaneprim.table.cosmos.azure.com/Tables('uttable37214ad') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/test_custom_entity.py b/sdk/tables/azure-data-tables/tests/test_custom_entity.py index 21d2dc0c0d74..29b7b0431115 100644 --- a/sdk/tables/azure-data-tables/tests/test_custom_entity.py +++ b/sdk/tables/azure-data-tables/tests/test_custom_entity.py @@ -34,8 +34,8 @@ ResourceModifiedError, ) -from _shared.testcase import TableTestCase -from preparers import TablesPreparer +from _shared.testcase import TableTestCase, SLEEP_DELAY +from preparers import TablesPreparer, CosmosPreparer # ------------------------------------------------------------------------------ from datetime import datetime @@ -263,4 +263,141 @@ def test_custom_entity_query(self, tables_storage_account_name, tables_primary_s assert length == 1 finally: - self._tear_down(tables_storage_account_name, tables_primary_storage_account_key) \ No newline at end of file + self._tear_down(tables_storage_account_name, tables_primary_storage_account_key) + + +class CosmosTableEntityTest(TableTestCase): + + def _set_up(self, tables_storage_account_name, tables_primary_storage_account_key, url='cosmos'): + table_name = self.get_resource_name('uttable') + ts = TableServiceClient( + self.account_url(tables_storage_account_name, url), + credential=tables_primary_storage_account_key, + table_name=table_name + ) + table = ts.get_table_client(table_name) + if self.is_live: + try: + ts.create_table(table_name) + except ResourceExistsError: + pass + return table + + def _tear_down(self, tables_storage_account_name, tables_primary_storage_account_key, url='cosmos'): + table_name = self.get_resource_name('uttable') + ts = TableServiceClient( + self.account_url(tables_storage_account_name, url), + credential=tables_primary_storage_account_key, + table_name=table_name + ) + if self.is_live: + try: + ts.delete_table(table_name) + except: + pass + self.sleep(SLEEP_DELAY) + + + @CosmosPreparer() + def test_custom_entity(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): + table_client = self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key) + + entity = { + u"PartitionKey": u"pk", + u"RowKey": u"rk", + u"Birthday": u"2020-01-01T12:59:59.0123456Z" + } + try: + with table_client as tc: + tc.create_entity(entity) + entity = tc.get_entity( + partition_key=entity[u'PartitionKey'], + row_key=entity[u'RowKey'], + entity_hook=MyEntity + ) + + assert isinstance(entity.properties['Birthday'], datetime) + assert 'milliseconds' in entity.keys() + assert entity.properties['milliseconds'] == .0123456 + assert entity.properties['Birthday'] == datetime(2020, 1, 1, 12, 59, 59) + + finally: + self._tear_down(tables_cosmos_account_name, tables_primary_cosmos_account_key) + + + @CosmosPreparer() + def test_custom_entity_list(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): + table_client = self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key) + + entity = { + u"PartitionKey": u"pk", + u"RowKey": u"rk", + u"Birthday": u"2020-01-01T12:59:59.0123456Z" + } + entity2 = { + u"PartitionKey": u"pk", + u"RowKey": u"rk1", + u"Birthday": u"2021-02-02T12:59:59.0123456Z" + } + try: + with table_client as tc: + tc.create_entity(entity) + tc.create_entity(entity2) + entities = tc.list_entities( + entity_hook=MyEntity + ) + + length = 0 + for entity in entities: + assert isinstance(entity.properties['Birthday'], datetime) + assert 'milliseconds' in entity.keys() + assert entity.properties['milliseconds'] == .0123456 + # assert entity.properties['Birthday'] == datetime(2020, 1, 1, 12, 59, 59) + length += 1 + assert length == 2 + + finally: + self._tear_down(tables_cosmos_account_name, tables_primary_cosmos_account_key) + + + @CosmosPreparer() + def test_custom_entity_query(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): + table_client = self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key) + + entity = { + u"PartitionKey": u"pk", + u"RowKey": u"rk", + u"Birthday": u"2020-01-01T12:59:59.0123456Z", + u"Value": 20 + } + entity2 = { + u"PartitionKey": u"pk", + u"RowKey": u"rk1", + u"Birthday": u"2021-02-02T12:59:59.0123456Z", + u"Value": 30 + } + try: + with table_client as tc: + tc.create_entity(entity) + tc.create_entity(entity2) + + f = "Value lt @value" + params = { + "value": 25 + } + entities = tc.query_entities( + filter=f, + parameters=params, + entity_hook=MyEntity + ) + + length = 0 + for entity in entities: + assert isinstance(entity.properties['Birthday'], datetime) + assert 'milliseconds' in entity.keys() + assert entity.properties['milliseconds'] == .0123456 + length += 1 + assert length == 1 + + finally: + self._tear_down(tables_cosmos_account_name, tables_primary_cosmos_account_key) \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/tests/test_custom_entity_async.py b/sdk/tables/azure-data-tables/tests/test_custom_entity_async.py new file mode 100644 index 000000000000..95a9f40cd708 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/test_custom_entity_async.py @@ -0,0 +1,390 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import pytest + +from datetime import datetime + +from azure.data.tables.aio import ( + TableServiceClient, + TableClient +) + +from azure.data.tables import ( + TableEntity, + EdmType, +) + +from azure.core.exceptions import ResourceExistsError + +from _shared.testcase import TableTestCase, SLEEP_DELAY +from preparers import TablesPreparer, CosmosPreparer + +# ------------------------------------------------------------------------------ +from datetime import datetime + +class MyEntity(object): + + def __init__(self, entry_element): + self.properties = {} + self.partition_key = entry_element.pop("PartitionKey") + self.row_key = entry_element.pop("RowKey") + self.timestamp = entry_element.pop("Timestamp") + + properties = {} + edmtypes = {} + odata = {} + + for name, value in entry_element.items(): + if name.startswith("odata."): + odata[name[6:]] = value + elif name.endswith("@odata.type"): + edmtypes[name[:-11]] = value + else: + properties[name] = value + + for name, value in properties.items(): + mtype = edmtypes.get(name) + + # Use Simple Ints + if type(value) is int and mtype in [EdmType.INT32, EdmType.INT64]: + self.properties[name] = int(value) + continue + + # Add type for String + try: + if type(value) is unicode and mtype is None: + self.properties[name] = unicode(value) + continue + except NameError: + if type(value) is str and mtype is None: # pylint:disable=C0123 + self.properties[name] = str(value) + continue + + self.properties[name] = value + + self.convert_birthdays() + + def convert_birthdays(self): + if 'birthday' in self.properties.keys(): + self.properties['birthday'], self.properties['milliseconds'] = self._convert_date(self.properties['birthday']) + if 'Birthday' in self.properties.keys(): + self.properties['Birthday'], self.properties['milliseconds'] = self._convert_date(self.properties['Birthday']) + + def _convert_date(self, bday): + if 'Z' in bday: + # Has milliseconds, we'll handle this separately + # Python library only handles 6 decimal places of precision + ms = bday.split('.')[-1] + ms = '.' + ms[:-1] + ms = float(ms) + date = bday.split('.')[0] + date = datetime.strptime(date, "%Y-%m-%dT%H:%M:%S") + return date, ms + else: + return datetime.strptime(date, "%Y-%m-%dT%H:%M:%S"), 0.0 + + def keys(self): + return self.properties.keys() + +def modify_returned_class(entity): + if 'birthday' in entity.keys(): + bday = entity['birthday'] + if 'Z' in bday: + ms = bday.split(':')[-1] + ms = '.' + ms + ms = float(ms) + date = bday.replace(str(ms), '') + date = datetime.strptime(date, "%Y-%m-%dT%H:%M") + entity['birthday'] = date + entity['birthday_ms'] = ms + if 'Birthday' in entity.keys(): + bday = entity['birthday'] + if 'Z' in bday: + ms = bday.split(':')[-1] + ms = '.' + ms + ms = float(ms) + date = bday.replace(str(ms), '') + date = datetime.strptime(date, "%Y-%m-%dT%H:%M") + entity['Birthday'] = date + entity['Birthday_ms'] = ms + + return entity + +class StorageTableEntityTest(TableTestCase): + + async def _set_up(self, tables_storage_account_name, tables_primary_storage_account_key, url='table'): + table_name = self.get_resource_name('uttable') + ts = TableServiceClient( + self.account_url(tables_storage_account_name, url), + credential=tables_primary_storage_account_key, + table_name=table_name + ) + table = ts.get_table_client(table_name) + if self.is_live: + try: + await ts.create_table(table_name) + except ResourceExistsError: + pass + return table + + async def _tear_down(self, tables_storage_account_name, tables_primary_storage_account_key, url='table'): + table_name = self.get_resource_name('uttable') + ts = TableServiceClient( + self.account_url(tables_storage_account_name, url), + credential=tables_primary_storage_account_key, + table_name=table_name + ) + if self.is_live: + try: + await ts.delete_table(table_name) + except: + pass + + + @TablesPreparer() + async def test_custom_entity(self, tables_storage_account_name, tables_primary_storage_account_key): + table_client = await self._set_up(tables_storage_account_name, tables_primary_storage_account_key) + + entity = { + u"PartitionKey": u"pk", + u"RowKey": u"rk", + u"Birthday": u"2020-01-01T12:59:59.0123456Z" + } + try: + async with table_client as tc: + await tc.create_entity(entity) + entity = await tc.get_entity( + partition_key=entity[u'PartitionKey'], + row_key=entity[u'RowKey'], + entity_hook=MyEntity + ) + + assert isinstance(entity.properties['Birthday'], datetime) + assert 'milliseconds' in entity.keys() + assert entity.properties['milliseconds'] == .0123456 + assert entity.properties['Birthday'] == datetime(2020, 1, 1, 12, 59, 59) + + finally: + await self._tear_down(tables_storage_account_name, tables_primary_storage_account_key) + + + @TablesPreparer() + async def test_custom_entity_list(self, tables_storage_account_name, tables_primary_storage_account_key): + table_client = await self._set_up(tables_storage_account_name, tables_primary_storage_account_key) + + entity = { + u"PartitionKey": u"pk", + u"RowKey": u"rk", + u"Birthday": u"2020-01-01T12:59:59.0123456Z" + } + entity2 = { + u"PartitionKey": u"pk", + u"RowKey": u"rk1", + u"Birthday": u"2021-02-02T12:59:59.0123456Z" + } + try: + async with table_client as tc: + await tc.create_entity(entity) + await tc.create_entity(entity2) + + entities = tc.list_entities( + entity_hook=MyEntity + ) + + length = 0 + async for entity in entities: + assert isinstance(entity.properties['Birthday'], datetime) + assert 'milliseconds' in entity.keys() + assert entity.properties['milliseconds'] == .0123456 + # assert entity.properties['Birthday'] == datetime(2020, 1, 1, 12, 59, 59) + length += 1 + assert length == 2 + + finally: + await self._tear_down(tables_storage_account_name, tables_primary_storage_account_key) + + + @TablesPreparer() + async def test_custom_entity_query(self, tables_storage_account_name, tables_primary_storage_account_key): + table_client = await self._set_up(tables_storage_account_name, tables_primary_storage_account_key) + + entity = { + u"PartitionKey": u"pk", + u"RowKey": u"rk", + u"Birthday": u"2020-01-01T12:59:59.0123456Z", + u"Value": 20 + } + entity2 = { + u"PartitionKey": u"pk", + u"RowKey": u"rk1", + u"Birthday": u"2021-02-02T12:59:59.0123456Z", + u"Value": 30 + } + try: + async with table_client as tc: + await tc.create_entity(entity) + await tc.create_entity(entity2) + + f = "Value lt @value" + params = { + "value": 25 + } + entities = tc.query_entities( + filter=f, + parameters=params, + entity_hook=MyEntity + ) + + length = 0 + async for entity in entities: + assert isinstance(entity.properties['Birthday'], datetime) + assert 'milliseconds' in entity.keys() + assert entity.properties['milliseconds'] == .0123456 + # assert entity.properties['Birthday'] == datetime(2020, 1, 1, 12, 59, 59) + length += 1 + assert length == 1 + + finally: + await self._tear_down(tables_storage_account_name, tables_primary_storage_account_key) + + +class CosmosTableEntityTest(TableTestCase): + + async def _set_up(self, tables_storage_account_name, tables_primary_storage_account_key, url='cosmos'): + table_name = self.get_resource_name('uttable') + ts = TableServiceClient( + self.account_url(tables_storage_account_name, url), + credential=tables_primary_storage_account_key, + table_name=table_name + ) + table = ts.get_table_client(table_name) + if self.is_live: + try: + await ts.create_table(table_name) + except ResourceExistsError: + pass + return table + + async def _tear_down(self, tables_storage_account_name, tables_primary_storage_account_key, url='cosmos'): + table_name = self.get_resource_name('uttable') + ts = TableServiceClient( + self.account_url(tables_storage_account_name, url), + credential=tables_primary_storage_account_key, + table_name=table_name + ) + if self.is_live: + try: + await ts.delete_table(table_name) + except: + pass + self.sleep(SLEEP_DELAY) + + + @CosmosPreparer() + async def test_custom_entity(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): + table_client = await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key) + + entity = { + u"PartitionKey": u"pk", + u"RowKey": u"rk", + u"Birthday": u"2020-01-01T12:59:59.0123456Z" + } + try: + async with table_client as tc: + await tc.create_entity(entity) + entity = await tc.get_entity( + partition_key=entity[u'PartitionKey'], + row_key=entity[u'RowKey'], + entity_hook=MyEntity + ) + + assert isinstance(entity.properties['Birthday'], datetime) + assert 'milliseconds' in entity.keys() + assert entity.properties['milliseconds'] == .0123456 + assert entity.properties['Birthday'] == datetime(2020, 1, 1, 12, 59, 59) + + finally: + await self._tear_down(tables_cosmos_account_name, tables_primary_cosmos_account_key) + + + @CosmosPreparer() + async def test_custom_entity_list(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): + table_client = await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key) + + entity = { + u"PartitionKey": u"pk", + u"RowKey": u"rk", + u"Birthday": u"2020-01-01T12:59:59.0123456Z" + } + entity2 = { + u"PartitionKey": u"pk", + u"RowKey": u"rk1", + u"Birthday": u"2021-02-02T12:59:59.0123456Z" + } + try: + async with table_client as tc: + await tc.create_entity(entity) + await tc.create_entity(entity2) + entities = tc.list_entities( + entity_hook=MyEntity + ) + + length = 0 + async for entity in entities: + assert isinstance(entity.properties['Birthday'], datetime) + assert 'milliseconds' in entity.keys() + assert entity.properties['milliseconds'] == .0123456 + # assert entity.properties['Birthday'] == datetime(2020, 1, 1, 12, 59, 59) + length += 1 + assert length == 2 + + finally: + await self._tear_down(tables_cosmos_account_name, tables_primary_cosmos_account_key) + + + @CosmosPreparer() + async def test_custom_entity_query(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): + table_client = await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key) + + entity = { + u"PartitionKey": u"pk", + u"RowKey": u"rk", + u"Birthday": u"2020-01-01T12:59:59.0123456Z", + u"Value": 20 + } + entity2 = { + u"PartitionKey": u"pk", + u"RowKey": u"rk1", + u"Birthday": u"2021-02-02T12:59:59.0123456Z", + u"Value": 30 + } + try: + async with table_client as tc: + await tc.create_entity(entity) + await tc.create_entity(entity2) + + f = "Value lt @value" + params = { + "value": 25 + } + entities = tc.query_entities( + filter=f, + parameters=params, + entity_hook=MyEntity + ) + + length = 0 + async for entity in entities: + assert isinstance(entity.properties['Birthday'], datetime) + assert 'milliseconds' in entity.keys() + assert entity.properties['milliseconds'] == .0123456 + length += 1 + assert length == 1 + + finally: + await self._tear_down(tables_cosmos_account_name, tables_primary_cosmos_account_key) From 58ad2a154399e9b27d0b856835b5af61247134c6 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Tue, 26 Jan 2021 11:07:11 -0500 Subject: [PATCH 3/7] re-formatting and cleaning up test files, touched package files too --- .../azure/data/tables/_models.py | 21 +- .../azure/data/tables/_table_client.py | 24 +- .../azure/data/tables/aio/_models.py | 3 +- .../data/tables/aio/_table_client_async.py | 22 +- .../tests/test_custom_entity.py | 303 ++++++++++-------- .../tests/test_custom_entity_async.py | 283 +++++++++------- 6 files changed, 368 insertions(+), 288 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 292a845abdf4..89629c41faba 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_models.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_models.py @@ -120,7 +120,7 @@ def _from_generated(cls, generated): write=generated.write, retention_policy=RetentionPolicy._from_generated( # pylint:disable=protected-access generated.retention_policy - ) + ), ) @@ -138,8 +138,7 @@ class Metrics(GeneratedMetrics): """ def __init__( # pylint:disable=super-init-not-called - self, - **kwargs # type: Any + self, **kwargs # type: Any ): self.version = kwargs.get("version", u"1.0") self.enabled = kwargs.get("enabled", False) @@ -161,7 +160,7 @@ def _from_generated(cls, generated): include_apis=generated.include_apis, retention_policy=RetentionPolicy._from_generated( # pylint: disable=protected-access generated.retention_policy - ) + ), ) @@ -307,7 +306,8 @@ def _get_next_cb(self, continuation_token, **kwargs): def _extract_data_cb(self, get_next_return): self.location_mode, self._response, self._headers = get_next_return props_list = [ - TableItem._from_generated(t, **self._headers) for t in self._response.value # pylint:disable=protected-access + TableItem._from_generated(t, **self._headers) + for t in self._response.value # pylint:disable=protected-access ] return self._headers[NEXT_TABLE_NAME] or None, props_list @@ -364,7 +364,9 @@ def _get_next_cb(self, continuation_token, **kwargs): def _extract_data_cb(self, get_next_return): self.location_mode, self._response, self._headers = get_next_return - props_list = [self.entity_hook(t) for t in self._response.value] #self._get_props_list() + props_list = [ + self.entity_hook(t) for t in self._response.value + ] # self._get_props_list() next_entity = {} if self._headers[NEXT_PARTITION_KEY] or self._headers[NEXT_ROW_KEY]: next_entity = { @@ -463,7 +465,9 @@ def service_stats_deserialize(generated): def service_properties_deserialize(generated): """Deserialize a ServiceProperties objects into a dict.""" return { - "analytics_logging": TableAnalyticsLogging._from_generated(generated.logging), # pylint: disable=protected-access + "analytics_logging": TableAnalyticsLogging._from_generated( + generated.logging + ), # pylint: disable=protected-access "hour_metrics": Metrics._from_generated( # pylint: disable=protected-access generated.hour_metrics ), @@ -471,7 +475,8 @@ def service_properties_deserialize(generated): generated.minute_metrics ), "cors": [ - CorsRule._from_generated(cors) for cors in generated.cors # pylint: disable=protected-access + CorsRule._from_generated(cors) + for cors in generated.cors # pylint: disable=protected-access ], } 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 c88991077ff4..a35cee84ccea 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 @@ -65,11 +65,11 @@ def __init__( super(TableClient, self).__init__( account_url, table_name, credential=credential, **kwargs ) - kwargs['connection_timeout'] = kwargs.get('connection_timeout') or CONNECTION_TIMEOUT + kwargs["connection_timeout"] = ( + kwargs.get("connection_timeout") or CONNECTION_TIMEOUT + ) self._client = AzureTable( - self.url, - policies=kwargs.pop('policies', self._policies), - **kwargs + self.url, policies=kwargs.pop("policies", self._policies), **kwargs ) @classmethod @@ -442,10 +442,12 @@ def list_entities( :dedent: 8 :caption: List all entities held within a table """ - entity_hook = kwargs.pop('entity_hook', None) + entity_hook = kwargs.pop("entity_hook", None) page_iterator_class = TableEntityPropertiesPaged if entity_hook: - page_iterator_class = functools.partial(TableEntityPropertiesPaged, entity_hook=entity_hook) + page_iterator_class = functools.partial( + TableEntityPropertiesPaged, entity_hook=entity_hook + ) user_select = kwargs.pop("select", None) if user_select and not isinstance(user_select, str): @@ -492,7 +494,9 @@ def query_entities( entity_hook = kwargs.pop("entity_hook", None) page_iterator_class = TableEntityPropertiesPaged if entity_hook: - page_iterator_class = functools.partial(TableEntityPropertiesPaged, entity_hook=entity_hook) + page_iterator_class = functools.partial( + TableEntityPropertiesPaged, entity_hook=entity_hook + ) parameters = kwargs.pop("parameters", None) filter = self._parameter_filter_substitution( @@ -540,7 +544,7 @@ def get_entity( :dedent: 8 :caption: Get a single entity from a table """ - entity_hook = kwargs.pop('entity_hook', None) + entity_hook = kwargs.pop("entity_hook", None) try: entity = self._client.table.query_entity_with_partition_and_row_key( table=self.table_name, @@ -669,5 +673,7 @@ def send_batch( :caption: Using batches to send multiple requests at once """ return self._batch_send( # pylint:disable=protected-access - batch._entities, *batch._requests, **kwargs # pylint:disable=protected-access + batch._entities, + *batch._requests, + **kwargs # pylint:disable=protected-access ) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py index 258ce56d31cb..ecee119d471a 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py @@ -60,7 +60,8 @@ async def _get_next_cb(self, continuation_token, **kwargs): async def _extract_data_cb(self, get_next_return): self.location_mode, self._response, self._headers = get_next_return props_list = [ - TableItem._from_generated(t, **self._headers) for t in self._response.value # pylint:disable=protected-access + TableItem._from_generated(t, **self._headers) + for t in self._response.value # pylint:disable=protected-access ] return self._headers[NEXT_TABLE_NAME] or None, props_list 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 95e93441302f..72e06b29e132 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 @@ -78,11 +78,13 @@ def __init__( loop=loop, **kwargs ) - kwargs['connection_timeout'] = kwargs.get('connection_timeout') or CONNECTION_TIMEOUT + kwargs["connection_timeout"] = ( + kwargs.get("connection_timeout") or CONNECTION_TIMEOUT + ) self._configure_policies(**kwargs) self._client = AzureTable( self.url, - policies=kwargs.pop('policies', self._policies), + policies=kwargs.pop("policies", self._policies), loop=loop, **kwargs ) @@ -460,10 +462,12 @@ def list_entities( :dedent: 8 :caption: Querying entities from a TableClient """ - entity_hook = kwargs.pop('entity_hook', None) + entity_hook = kwargs.pop("entity_hook", None) page_iterator_class = TableEntityPropertiesPaged if entity_hook: - page_iterator_class = functools.partial(TableEntityPropertiesPaged, entity_hook=entity_hook) + page_iterator_class = functools.partial( + TableEntityPropertiesPaged, entity_hook=entity_hook + ) user_select = kwargs.pop("select", None) if user_select and not isinstance(user_select, str): @@ -510,7 +514,9 @@ def query_entities( entity_hook = kwargs.pop("entity_hook", None) page_iterator_class = TableEntityPropertiesPaged if entity_hook: - page_iterator_class = functools.partial(TableEntityPropertiesPaged, entity_hook=entity_hook) + page_iterator_class = functools.partial( + TableEntityPropertiesPaged, entity_hook=entity_hook + ) parameters = kwargs.pop("parameters", None) filter = self._parameter_filter_substitution( @@ -559,7 +565,7 @@ async def get_entity( :dedent: 8 :caption: Getting an entity from PartitionKey and RowKey """ - entity_hook = kwargs.pop('entity_hook', None) + entity_hook = kwargs.pop("entity_hook", None) try: entity = await self._client.table.query_entity_with_partition_and_row_key( table=self.table_name, @@ -684,5 +690,7 @@ async def send_batch( :caption: Using batches to send multiple requests at once """ return await self._batch_send( - batch._entities, *batch._requests, **kwargs # pylint:disable=protected-access + batch._entities, + *batch._requests, + **kwargs # pylint:disable=protected-access ) diff --git a/sdk/tables/azure-data-tables/tests/test_custom_entity.py b/sdk/tables/azure-data-tables/tests/test_custom_entity.py index 29b7b0431115..a6f77628420d 100644 --- a/sdk/tables/azure-data-tables/tests/test_custom_entity.py +++ b/sdk/tables/azure-data-tables/tests/test_custom_entity.py @@ -7,41 +7,20 @@ # -------------------------------------------------------------------------- import pytest -from base64 import b64encode -from datetime import datetime, timedelta -from dateutil.tz import tzutc, tzoffset -from enum import Enum -from math import isnan -import uuid +from datetime import datetime from azure.data.tables import ( TableServiceClient, TableClient, - generate_table_sas, - TableEntity, - EntityProperty, EdmType, - TableSasPermissions, - AccessPolicy, - UpdateMode -) - -from azure.core import MatchConditions -from azure.core.exceptions import ( - HttpResponseError, - ResourceNotFoundError, - ResourceExistsError, - ResourceModifiedError, ) +from azure.core.exceptions import ResourceExistsError from _shared.testcase import TableTestCase, SLEEP_DELAY from preparers import TablesPreparer, CosmosPreparer -# ------------------------------------------------------------------------------ -from datetime import datetime class MyEntity(object): - def __init__(self, entry_element): self.properties = {} self.partition_key = entry_element.pop("PartitionKey") @@ -83,19 +62,25 @@ def __init__(self, entry_element): self.convert_birthdays() def convert_birthdays(self): - if 'birthday' in self.properties.keys(): - self.properties['birthday'], self.properties['milliseconds'] = self._convert_date(self.properties['birthday']) - if 'Birthday' in self.properties.keys(): - self.properties['Birthday'], self.properties['milliseconds'] = self._convert_date(self.properties['Birthday']) + if "birthday" in self.properties.keys(): + ( + self.properties["birthday"], + self.properties["milliseconds"], + ) = self._convert_date(self.properties["birthday"]) + if "Birthday" in self.properties.keys(): + ( + self.properties["Birthday"], + self.properties["milliseconds"], + ) = self._convert_date(self.properties["Birthday"]) def _convert_date(self, bday): - if 'Z' in bday: + if "Z" in bday: # Has milliseconds, we'll handle this separately # Python library only handles 6 decimal places of precision - ms = bday.split('.')[-1] - ms = '.' + ms[:-1] + ms = bday.split(".")[-1] + ms = "." + ms[:-1] ms = float(ms) - date = bday.split('.')[0] + date = bday.split(".")[0] date = datetime.strptime(date, "%Y-%m-%dT%H:%M:%S") return date, ms else: @@ -104,39 +89,44 @@ def _convert_date(self, bday): def keys(self): return self.properties.keys() + def modify_returned_class(entity): - if 'birthday' in entity.keys(): - bday = entity['birthday'] - if 'Z' in bday: - ms = bday.split(':')[-1] - ms = '.' + ms + if "birthday" in entity.keys(): + bday = entity["birthday"] + if "Z" in bday: + ms = bday.split(":")[-1] + ms = "." + ms ms = float(ms) - date = bday.replace(str(ms), '') + date = bday.replace(str(ms), "") date = datetime.strptime(date, "%Y-%m-%dT%H:%M") - entity['birthday'] = date - entity['birthday_ms'] = ms - if 'Birthday' in entity.keys(): - bday = entity['birthday'] - if 'Z' in bday: - ms = bday.split(':')[-1] - ms = '.' + ms + entity["birthday"] = date + entity["birthday_ms"] = ms + if "Birthday" in entity.keys(): + bday = entity["birthday"] + if "Z" in bday: + ms = bday.split(":")[-1] + ms = "." + ms ms = float(ms) - date = bday.replace(str(ms), '') + date = bday.replace(str(ms), "") date = datetime.strptime(date, "%Y-%m-%dT%H:%M") - entity['Birthday'] = date - entity['Birthday_ms'] = ms + entity["Birthday"] = date + entity["Birthday_ms"] = ms return entity class StorageTableEntityTest(TableTestCase): - - def _set_up(self, tables_storage_account_name, tables_primary_storage_account_key, url='table'): - table_name = self.get_resource_name('uttable') + def _set_up( + self, + tables_storage_account_name, + tables_primary_storage_account_key, + url="table", + ): + table_name = self.get_resource_name("uttable") ts = TableServiceClient( self.account_url(tables_storage_account_name, url), credential=tables_primary_storage_account_key, - table_name=table_name + table_name=table_name, ) table = ts.get_table_client(table_name) if self.is_live: @@ -146,12 +136,17 @@ def _set_up(self, tables_storage_account_name, tables_primary_storage_account_ke pass return table - def _tear_down(self, tables_storage_account_name, tables_primary_storage_account_key, url='table'): - table_name = self.get_resource_name('uttable') + def _tear_down( + self, + tables_storage_account_name, + tables_primary_storage_account_key, + url="table", + ): + table_name = self.get_resource_name("uttable") ts = TableServiceClient( self.account_url(tables_storage_account_name, url), credential=tables_primary_storage_account_key, - table_name=table_name + table_name=table_name, ) if self.is_live: try: @@ -159,84 +154,94 @@ def _tear_down(self, tables_storage_account_name, tables_primary_storage_account except: pass - @TablesPreparer() - def test_custom_entity(self, tables_storage_account_name, tables_primary_storage_account_key): - table_client = self._set_up(tables_storage_account_name, tables_primary_storage_account_key) + def test_custom_entity( + self, tables_storage_account_name, tables_primary_storage_account_key + ): + table_client = self._set_up( + tables_storage_account_name, tables_primary_storage_account_key + ) entity = { u"PartitionKey": u"pk", u"RowKey": u"rk", - u"Birthday": u"2020-01-01T12:59:59.0123456Z" + u"Birthday": u"2020-01-01T12:59:59.0123456Z", } try: with table_client as tc: tc.create_entity(entity) entity = tc.get_entity( - partition_key=entity[u'PartitionKey'], - row_key=entity[u'RowKey'], - entity_hook=MyEntity + partition_key=entity[u"PartitionKey"], + row_key=entity[u"RowKey"], + entity_hook=MyEntity, ) - assert isinstance(entity.properties['Birthday'], datetime) - assert 'milliseconds' in entity.keys() - assert entity.properties['milliseconds'] == .0123456 - assert entity.properties['Birthday'] == datetime(2020, 1, 1, 12, 59, 59) + assert isinstance(entity.properties["Birthday"], datetime) + assert "milliseconds" in entity.keys() + assert entity.properties["milliseconds"] == 0.0123456 + assert entity.properties["Birthday"] == datetime(2020, 1, 1, 12, 59, 59) finally: - self._tear_down(tables_storage_account_name, tables_primary_storage_account_key) - + self._tear_down( + tables_storage_account_name, tables_primary_storage_account_key + ) @TablesPreparer() - def test_custom_entity_list(self, tables_storage_account_name, tables_primary_storage_account_key): - table_client = self._set_up(tables_storage_account_name, tables_primary_storage_account_key) + def test_custom_entity_list( + self, tables_storage_account_name, tables_primary_storage_account_key + ): + table_client = self._set_up( + tables_storage_account_name, tables_primary_storage_account_key + ) entity = { u"PartitionKey": u"pk", u"RowKey": u"rk", - u"Birthday": u"2020-01-01T12:59:59.0123456Z" + u"Birthday": u"2020-01-01T12:59:59.0123456Z", } entity2 = { u"PartitionKey": u"pk", u"RowKey": u"rk1", - u"Birthday": u"2021-02-02T12:59:59.0123456Z" + u"Birthday": u"2021-02-02T12:59:59.0123456Z", } try: with table_client as tc: tc.create_entity(entity) tc.create_entity(entity2) - entities = tc.list_entities( - entity_hook=MyEntity - ) + entities = tc.list_entities(entity_hook=MyEntity) length = 0 for entity in entities: - assert isinstance(entity.properties['Birthday'], datetime) - assert 'milliseconds' in entity.keys() - assert entity.properties['milliseconds'] == .0123456 - # assert entity.properties['Birthday'] == datetime(2020, 1, 1, 12, 59, 59) + assert isinstance(entity.properties["Birthday"], datetime) + assert "milliseconds" in entity.keys() + assert entity.properties["milliseconds"] == 0.0123456 length += 1 assert length == 2 finally: - self._tear_down(tables_storage_account_name, tables_primary_storage_account_key) - + self._tear_down( + tables_storage_account_name, tables_primary_storage_account_key + ) @TablesPreparer() - def test_custom_entity_query(self, tables_storage_account_name, tables_primary_storage_account_key): - table_client = self._set_up(tables_storage_account_name, tables_primary_storage_account_key) + def test_custom_entity_query( + self, tables_storage_account_name, tables_primary_storage_account_key + ): + table_client = self._set_up( + tables_storage_account_name, tables_primary_storage_account_key + ) entity = { u"PartitionKey": u"pk", u"RowKey": u"rk", u"Birthday": u"2020-01-01T12:59:59.0123456Z", - u"Value": 20 + u"Value": 20, } entity2 = { u"PartitionKey": u"pk", u"RowKey": u"rk1", u"Birthday": u"2021-02-02T12:59:59.0123456Z", - u"Value": 30 + u"Value": 30, } try: with table_client as tc: @@ -244,36 +249,37 @@ def test_custom_entity_query(self, tables_storage_account_name, tables_primary_s tc.create_entity(entity2) f = "Value lt @value" - params = { - "value": 25 - } + params = {"value": 25} entities = tc.query_entities( - filter=f, - parameters=params, - entity_hook=MyEntity + filter=f, parameters=params, entity_hook=MyEntity ) length = 0 for entity in entities: - assert isinstance(entity.properties['Birthday'], datetime) - assert 'milliseconds' in entity.keys() - assert entity.properties['milliseconds'] == .0123456 - # assert entity.properties['Birthday'] == datetime(2020, 1, 1, 12, 59, 59) + assert isinstance(entity.properties["Birthday"], datetime) + assert "milliseconds" in entity.keys() + assert entity.properties["milliseconds"] == 0.0123456 length += 1 assert length == 1 finally: - self._tear_down(tables_storage_account_name, tables_primary_storage_account_key) + self._tear_down( + tables_storage_account_name, tables_primary_storage_account_key + ) class CosmosTableEntityTest(TableTestCase): - - def _set_up(self, tables_storage_account_name, tables_primary_storage_account_key, url='cosmos'): - table_name = self.get_resource_name('uttable') + def _set_up( + self, + tables_storage_account_name, + tables_primary_storage_account_key, + url="cosmos", + ): + table_name = self.get_resource_name("uttable") ts = TableServiceClient( self.account_url(tables_storage_account_name, url), credential=tables_primary_storage_account_key, - table_name=table_name + table_name=table_name, ) table = ts.get_table_client(table_name) if self.is_live: @@ -283,12 +289,17 @@ def _set_up(self, tables_storage_account_name, tables_primary_storage_account_ke pass return table - def _tear_down(self, tables_storage_account_name, tables_primary_storage_account_key, url='cosmos'): - table_name = self.get_resource_name('uttable') + def _tear_down( + self, + tables_storage_account_name, + tables_primary_storage_account_key, + url="cosmos", + ): + table_name = self.get_resource_name("uttable") ts = TableServiceClient( self.account_url(tables_storage_account_name, url), credential=tables_primary_storage_account_key, - table_name=table_name + table_name=table_name, ) if self.is_live: try: @@ -297,84 +308,94 @@ def _tear_down(self, tables_storage_account_name, tables_primary_storage_account pass self.sleep(SLEEP_DELAY) - @CosmosPreparer() - def test_custom_entity(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): - table_client = self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key) + def test_custom_entity( + self, tables_cosmos_account_name, tables_primary_cosmos_account_key + ): + table_client = self._set_up( + tables_cosmos_account_name, tables_primary_cosmos_account_key + ) entity = { u"PartitionKey": u"pk", u"RowKey": u"rk", - u"Birthday": u"2020-01-01T12:59:59.0123456Z" + u"Birthday": u"2020-01-01T12:59:59.0123456Z", } try: with table_client as tc: tc.create_entity(entity) entity = tc.get_entity( - partition_key=entity[u'PartitionKey'], - row_key=entity[u'RowKey'], - entity_hook=MyEntity + partition_key=entity[u"PartitionKey"], + row_key=entity[u"RowKey"], + entity_hook=MyEntity, ) - assert isinstance(entity.properties['Birthday'], datetime) - assert 'milliseconds' in entity.keys() - assert entity.properties['milliseconds'] == .0123456 - assert entity.properties['Birthday'] == datetime(2020, 1, 1, 12, 59, 59) + assert isinstance(entity.properties["Birthday"], datetime) + assert "milliseconds" in entity.keys() + assert entity.properties["milliseconds"] == 0.0123456 + assert entity.properties["Birthday"] == datetime(2020, 1, 1, 12, 59, 59) finally: - self._tear_down(tables_cosmos_account_name, tables_primary_cosmos_account_key) - + self._tear_down( + tables_cosmos_account_name, tables_primary_cosmos_account_key + ) @CosmosPreparer() - def test_custom_entity_list(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): - table_client = self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key) + def test_custom_entity_list( + self, tables_cosmos_account_name, tables_primary_cosmos_account_key + ): + table_client = self._set_up( + tables_cosmos_account_name, tables_primary_cosmos_account_key + ) entity = { u"PartitionKey": u"pk", u"RowKey": u"rk", - u"Birthday": u"2020-01-01T12:59:59.0123456Z" + u"Birthday": u"2020-01-01T12:59:59.0123456Z", } entity2 = { u"PartitionKey": u"pk", u"RowKey": u"rk1", - u"Birthday": u"2021-02-02T12:59:59.0123456Z" + u"Birthday": u"2021-02-02T12:59:59.0123456Z", } try: with table_client as tc: tc.create_entity(entity) tc.create_entity(entity2) - entities = tc.list_entities( - entity_hook=MyEntity - ) + entities = tc.list_entities(entity_hook=MyEntity) length = 0 for entity in entities: - assert isinstance(entity.properties['Birthday'], datetime) - assert 'milliseconds' in entity.keys() - assert entity.properties['milliseconds'] == .0123456 - # assert entity.properties['Birthday'] == datetime(2020, 1, 1, 12, 59, 59) + assert isinstance(entity.properties["Birthday"], datetime) + assert "milliseconds" in entity.keys() + assert entity.properties["milliseconds"] == 0.0123456 length += 1 assert length == 2 finally: - self._tear_down(tables_cosmos_account_name, tables_primary_cosmos_account_key) - + self._tear_down( + tables_cosmos_account_name, tables_primary_cosmos_account_key + ) @CosmosPreparer() - def test_custom_entity_query(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): - table_client = self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key) + def test_custom_entity_query( + self, tables_cosmos_account_name, tables_primary_cosmos_account_key + ): + table_client = self._set_up( + tables_cosmos_account_name, tables_primary_cosmos_account_key + ) entity = { u"PartitionKey": u"pk", u"RowKey": u"rk", u"Birthday": u"2020-01-01T12:59:59.0123456Z", - u"Value": 20 + u"Value": 20, } entity2 = { u"PartitionKey": u"pk", u"RowKey": u"rk1", u"Birthday": u"2021-02-02T12:59:59.0123456Z", - u"Value": 30 + u"Value": 30, } try: with table_client as tc: @@ -382,22 +403,20 @@ def test_custom_entity_query(self, tables_cosmos_account_name, tables_primary_co tc.create_entity(entity2) f = "Value lt @value" - params = { - "value": 25 - } + params = {"value": 25} entities = tc.query_entities( - filter=f, - parameters=params, - entity_hook=MyEntity + filter=f, parameters=params, entity_hook=MyEntity ) length = 0 for entity in entities: - assert isinstance(entity.properties['Birthday'], datetime) - assert 'milliseconds' in entity.keys() - assert entity.properties['milliseconds'] == .0123456 + assert isinstance(entity.properties["Birthday"], datetime) + assert "milliseconds" in entity.keys() + assert entity.properties["milliseconds"] == 0.0123456 length += 1 assert length == 1 finally: - self._tear_down(tables_cosmos_account_name, tables_primary_cosmos_account_key) \ No newline at end of file + self._tear_down( + tables_cosmos_account_name, tables_primary_cosmos_account_key + ) diff --git a/sdk/tables/azure-data-tables/tests/test_custom_entity_async.py b/sdk/tables/azure-data-tables/tests/test_custom_entity_async.py index 95a9f40cd708..88d5f41f5b07 100644 --- a/sdk/tables/azure-data-tables/tests/test_custom_entity_async.py +++ b/sdk/tables/azure-data-tables/tests/test_custom_entity_async.py @@ -9,10 +9,7 @@ from datetime import datetime -from azure.data.tables.aio import ( - TableServiceClient, - TableClient -) +from azure.data.tables.aio import TableServiceClient, TableClient from azure.data.tables import ( TableEntity, @@ -27,8 +24,8 @@ # ------------------------------------------------------------------------------ from datetime import datetime -class MyEntity(object): +class MyEntity(object): def __init__(self, entry_element): self.properties = {} self.partition_key = entry_element.pop("PartitionKey") @@ -70,19 +67,25 @@ def __init__(self, entry_element): self.convert_birthdays() def convert_birthdays(self): - if 'birthday' in self.properties.keys(): - self.properties['birthday'], self.properties['milliseconds'] = self._convert_date(self.properties['birthday']) - if 'Birthday' in self.properties.keys(): - self.properties['Birthday'], self.properties['milliseconds'] = self._convert_date(self.properties['Birthday']) + if "birthday" in self.properties.keys(): + ( + self.properties["birthday"], + self.properties["milliseconds"], + ) = self._convert_date(self.properties["birthday"]) + if "Birthday" in self.properties.keys(): + ( + self.properties["Birthday"], + self.properties["milliseconds"], + ) = self._convert_date(self.properties["Birthday"]) def _convert_date(self, bday): - if 'Z' in bday: + if "Z" in bday: # Has milliseconds, we'll handle this separately # Python library only handles 6 decimal places of precision - ms = bday.split('.')[-1] - ms = '.' + ms[:-1] + ms = bday.split(".")[-1] + ms = "." + ms[:-1] ms = float(ms) - date = bday.split('.')[0] + date = bday.split(".")[0] date = datetime.strptime(date, "%Y-%m-%dT%H:%M:%S") return date, ms else: @@ -91,38 +94,44 @@ def _convert_date(self, bday): def keys(self): return self.properties.keys() + def modify_returned_class(entity): - if 'birthday' in entity.keys(): - bday = entity['birthday'] - if 'Z' in bday: - ms = bday.split(':')[-1] - ms = '.' + ms + if "birthday" in entity.keys(): + bday = entity["birthday"] + if "Z" in bday: + ms = bday.split(":")[-1] + ms = "." + ms ms = float(ms) - date = bday.replace(str(ms), '') + date = bday.replace(str(ms), "") date = datetime.strptime(date, "%Y-%m-%dT%H:%M") - entity['birthday'] = date - entity['birthday_ms'] = ms - if 'Birthday' in entity.keys(): - bday = entity['birthday'] - if 'Z' in bday: - ms = bday.split(':')[-1] - ms = '.' + ms + entity["birthday"] = date + entity["birthday_ms"] = ms + if "Birthday" in entity.keys(): + bday = entity["birthday"] + if "Z" in bday: + ms = bday.split(":")[-1] + ms = "." + ms ms = float(ms) - date = bday.replace(str(ms), '') + date = bday.replace(str(ms), "") date = datetime.strptime(date, "%Y-%m-%dT%H:%M") - entity['Birthday'] = date - entity['Birthday_ms'] = ms + entity["Birthday"] = date + entity["Birthday_ms"] = ms return entity -class StorageTableEntityTest(TableTestCase): - async def _set_up(self, tables_storage_account_name, tables_primary_storage_account_key, url='table'): - table_name = self.get_resource_name('uttable') +class StorageTableEntityTest(TableTestCase): + async def _set_up( + self, + tables_storage_account_name, + tables_primary_storage_account_key, + url="table", + ): + table_name = self.get_resource_name("uttable") ts = TableServiceClient( self.account_url(tables_storage_account_name, url), credential=tables_primary_storage_account_key, - table_name=table_name + table_name=table_name, ) table = ts.get_table_client(table_name) if self.is_live: @@ -132,12 +141,17 @@ async def _set_up(self, tables_storage_account_name, tables_primary_storage_acco pass return table - async def _tear_down(self, tables_storage_account_name, tables_primary_storage_account_key, url='table'): - table_name = self.get_resource_name('uttable') + async def _tear_down( + self, + tables_storage_account_name, + tables_primary_storage_account_key, + url="table", + ): + table_name = self.get_resource_name("uttable") ts = TableServiceClient( self.account_url(tables_storage_account_name, url), credential=tables_primary_storage_account_key, - table_name=table_name + table_name=table_name, ) if self.is_live: try: @@ -145,85 +159,96 @@ async def _tear_down(self, tables_storage_account_name, tables_primary_storage_a except: pass - @TablesPreparer() - async def test_custom_entity(self, tables_storage_account_name, tables_primary_storage_account_key): - table_client = await self._set_up(tables_storage_account_name, tables_primary_storage_account_key) + async def test_custom_entity( + self, tables_storage_account_name, tables_primary_storage_account_key + ): + table_client = await self._set_up( + tables_storage_account_name, tables_primary_storage_account_key + ) entity = { u"PartitionKey": u"pk", u"RowKey": u"rk", - u"Birthday": u"2020-01-01T12:59:59.0123456Z" + u"Birthday": u"2020-01-01T12:59:59.0123456Z", } try: async with table_client as tc: await tc.create_entity(entity) entity = await tc.get_entity( - partition_key=entity[u'PartitionKey'], - row_key=entity[u'RowKey'], - entity_hook=MyEntity + partition_key=entity[u"PartitionKey"], + row_key=entity[u"RowKey"], + entity_hook=MyEntity, ) - assert isinstance(entity.properties['Birthday'], datetime) - assert 'milliseconds' in entity.keys() - assert entity.properties['milliseconds'] == .0123456 - assert entity.properties['Birthday'] == datetime(2020, 1, 1, 12, 59, 59) + assert isinstance(entity.properties["Birthday"], datetime) + assert "milliseconds" in entity.keys() + assert entity.properties["milliseconds"] == 0.0123456 + assert entity.properties["Birthday"] == datetime(2020, 1, 1, 12, 59, 59) finally: - await self._tear_down(tables_storage_account_name, tables_primary_storage_account_key) - + await self._tear_down( + tables_storage_account_name, tables_primary_storage_account_key + ) @TablesPreparer() - async def test_custom_entity_list(self, tables_storage_account_name, tables_primary_storage_account_key): - table_client = await self._set_up(tables_storage_account_name, tables_primary_storage_account_key) + async def test_custom_entity_list( + self, tables_storage_account_name, tables_primary_storage_account_key + ): + table_client = await self._set_up( + tables_storage_account_name, tables_primary_storage_account_key + ) entity = { u"PartitionKey": u"pk", u"RowKey": u"rk", - u"Birthday": u"2020-01-01T12:59:59.0123456Z" + u"Birthday": u"2020-01-01T12:59:59.0123456Z", } entity2 = { u"PartitionKey": u"pk", u"RowKey": u"rk1", - u"Birthday": u"2021-02-02T12:59:59.0123456Z" + u"Birthday": u"2021-02-02T12:59:59.0123456Z", } try: async with table_client as tc: await tc.create_entity(entity) await tc.create_entity(entity2) - entities = tc.list_entities( - entity_hook=MyEntity - ) + entities = tc.list_entities(entity_hook=MyEntity) length = 0 async for entity in entities: - assert isinstance(entity.properties['Birthday'], datetime) - assert 'milliseconds' in entity.keys() - assert entity.properties['milliseconds'] == .0123456 + assert isinstance(entity.properties["Birthday"], datetime) + assert "milliseconds" in entity.keys() + assert entity.properties["milliseconds"] == 0.0123456 # assert entity.properties['Birthday'] == datetime(2020, 1, 1, 12, 59, 59) length += 1 assert length == 2 finally: - await self._tear_down(tables_storage_account_name, tables_primary_storage_account_key) - + await self._tear_down( + tables_storage_account_name, tables_primary_storage_account_key + ) @TablesPreparer() - async def test_custom_entity_query(self, tables_storage_account_name, tables_primary_storage_account_key): - table_client = await self._set_up(tables_storage_account_name, tables_primary_storage_account_key) + async def test_custom_entity_query( + self, tables_storage_account_name, tables_primary_storage_account_key + ): + table_client = await self._set_up( + tables_storage_account_name, tables_primary_storage_account_key + ) entity = { u"PartitionKey": u"pk", u"RowKey": u"rk", u"Birthday": u"2020-01-01T12:59:59.0123456Z", - u"Value": 20 + u"Value": 20, } entity2 = { u"PartitionKey": u"pk", u"RowKey": u"rk1", u"Birthday": u"2021-02-02T12:59:59.0123456Z", - u"Value": 30 + u"Value": 30, } try: async with table_client as tc: @@ -231,36 +256,38 @@ async def test_custom_entity_query(self, tables_storage_account_name, tables_pri await tc.create_entity(entity2) f = "Value lt @value" - params = { - "value": 25 - } + params = {"value": 25} entities = tc.query_entities( - filter=f, - parameters=params, - entity_hook=MyEntity + filter=f, parameters=params, entity_hook=MyEntity ) length = 0 async for entity in entities: - assert isinstance(entity.properties['Birthday'], datetime) - assert 'milliseconds' in entity.keys() - assert entity.properties['milliseconds'] == .0123456 + assert isinstance(entity.properties["Birthday"], datetime) + assert "milliseconds" in entity.keys() + assert entity.properties["milliseconds"] == 0.0123456 # assert entity.properties['Birthday'] == datetime(2020, 1, 1, 12, 59, 59) length += 1 assert length == 1 finally: - await self._tear_down(tables_storage_account_name, tables_primary_storage_account_key) + await self._tear_down( + tables_storage_account_name, tables_primary_storage_account_key + ) class CosmosTableEntityTest(TableTestCase): - - async def _set_up(self, tables_storage_account_name, tables_primary_storage_account_key, url='cosmos'): - table_name = self.get_resource_name('uttable') + async def _set_up( + self, + tables_storage_account_name, + tables_primary_storage_account_key, + url="cosmos", + ): + table_name = self.get_resource_name("uttable") ts = TableServiceClient( self.account_url(tables_storage_account_name, url), credential=tables_primary_storage_account_key, - table_name=table_name + table_name=table_name, ) table = ts.get_table_client(table_name) if self.is_live: @@ -270,12 +297,17 @@ async def _set_up(self, tables_storage_account_name, tables_primary_storage_acco pass return table - async def _tear_down(self, tables_storage_account_name, tables_primary_storage_account_key, url='cosmos'): - table_name = self.get_resource_name('uttable') + async def _tear_down( + self, + tables_storage_account_name, + tables_primary_storage_account_key, + url="cosmos", + ): + table_name = self.get_resource_name("uttable") ts = TableServiceClient( self.account_url(tables_storage_account_name, url), credential=tables_primary_storage_account_key, - table_name=table_name + table_name=table_name, ) if self.is_live: try: @@ -284,84 +316,95 @@ async def _tear_down(self, tables_storage_account_name, tables_primary_storage_a pass self.sleep(SLEEP_DELAY) - @CosmosPreparer() - async def test_custom_entity(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): - table_client = await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key) + async def test_custom_entity( + self, tables_cosmos_account_name, tables_primary_cosmos_account_key + ): + table_client = await self._set_up( + tables_cosmos_account_name, tables_primary_cosmos_account_key + ) entity = { u"PartitionKey": u"pk", u"RowKey": u"rk", - u"Birthday": u"2020-01-01T12:59:59.0123456Z" + u"Birthday": u"2020-01-01T12:59:59.0123456Z", } try: async with table_client as tc: await tc.create_entity(entity) entity = await tc.get_entity( - partition_key=entity[u'PartitionKey'], - row_key=entity[u'RowKey'], - entity_hook=MyEntity + partition_key=entity[u"PartitionKey"], + row_key=entity[u"RowKey"], + entity_hook=MyEntity, ) - assert isinstance(entity.properties['Birthday'], datetime) - assert 'milliseconds' in entity.keys() - assert entity.properties['milliseconds'] == .0123456 - assert entity.properties['Birthday'] == datetime(2020, 1, 1, 12, 59, 59) + assert isinstance(entity.properties["Birthday"], datetime) + assert "milliseconds" in entity.keys() + assert entity.properties["milliseconds"] == 0.0123456 + assert entity.properties["Birthday"] == datetime(2020, 1, 1, 12, 59, 59) finally: - await self._tear_down(tables_cosmos_account_name, tables_primary_cosmos_account_key) - + await self._tear_down( + tables_cosmos_account_name, tables_primary_cosmos_account_key + ) @CosmosPreparer() - async def test_custom_entity_list(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): - table_client = await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key) + async def test_custom_entity_list( + self, tables_cosmos_account_name, tables_primary_cosmos_account_key + ): + table_client = await self._set_up( + tables_cosmos_account_name, tables_primary_cosmos_account_key + ) entity = { u"PartitionKey": u"pk", u"RowKey": u"rk", - u"Birthday": u"2020-01-01T12:59:59.0123456Z" + u"Birthday": u"2020-01-01T12:59:59.0123456Z", } entity2 = { u"PartitionKey": u"pk", u"RowKey": u"rk1", - u"Birthday": u"2021-02-02T12:59:59.0123456Z" + u"Birthday": u"2021-02-02T12:59:59.0123456Z", } try: async with table_client as tc: await tc.create_entity(entity) await tc.create_entity(entity2) - entities = tc.list_entities( - entity_hook=MyEntity - ) + entities = tc.list_entities(entity_hook=MyEntity) length = 0 async for entity in entities: - assert isinstance(entity.properties['Birthday'], datetime) - assert 'milliseconds' in entity.keys() - assert entity.properties['milliseconds'] == .0123456 + assert isinstance(entity.properties["Birthday"], datetime) + assert "milliseconds" in entity.keys() + assert entity.properties["milliseconds"] == 0.0123456 # assert entity.properties['Birthday'] == datetime(2020, 1, 1, 12, 59, 59) length += 1 assert length == 2 finally: - await self._tear_down(tables_cosmos_account_name, tables_primary_cosmos_account_key) - + await self._tear_down( + tables_cosmos_account_name, tables_primary_cosmos_account_key + ) @CosmosPreparer() - async def test_custom_entity_query(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): - table_client = await self._set_up(tables_cosmos_account_name, tables_primary_cosmos_account_key) + async def test_custom_entity_query( + self, tables_cosmos_account_name, tables_primary_cosmos_account_key + ): + table_client = await self._set_up( + tables_cosmos_account_name, tables_primary_cosmos_account_key + ) entity = { u"PartitionKey": u"pk", u"RowKey": u"rk", u"Birthday": u"2020-01-01T12:59:59.0123456Z", - u"Value": 20 + u"Value": 20, } entity2 = { u"PartitionKey": u"pk", u"RowKey": u"rk1", u"Birthday": u"2021-02-02T12:59:59.0123456Z", - u"Value": 30 + u"Value": 30, } try: async with table_client as tc: @@ -369,22 +412,20 @@ async def test_custom_entity_query(self, tables_cosmos_account_name, tables_prim await tc.create_entity(entity2) f = "Value lt @value" - params = { - "value": 25 - } + params = {"value": 25} entities = tc.query_entities( - filter=f, - parameters=params, - entity_hook=MyEntity + filter=f, parameters=params, entity_hook=MyEntity ) length = 0 async for entity in entities: - assert isinstance(entity.properties['Birthday'], datetime) - assert 'milliseconds' in entity.keys() - assert entity.properties['milliseconds'] == .0123456 + assert isinstance(entity.properties["Birthday"], datetime) + assert "milliseconds" in entity.keys() + assert entity.properties["milliseconds"] == 0.0123456 length += 1 assert length == 1 finally: - await self._tear_down(tables_cosmos_account_name, tables_primary_cosmos_account_key) + await self._tear_down( + tables_cosmos_account_name, tables_primary_cosmos_account_key + ) From 5f8c9498f03573b1b6823a517f089c0755126ea9 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Tue, 26 Jan 2021 16:42:10 -0500 Subject: [PATCH 4/7] cosmos recordings and pylint fixes --- .../azure/data/tables/_models.py | 10 +- .../azure/data/tables/_table_client.py | 6 +- .../azure/data/tables/aio/_models.py | 2 +- .../data/tables/aio/_table_client_async.py | 6 +- ...test_custom_entity.test_custom_entity.yaml | 90 +++++--- ...stom_entity.test_custom_entity_cosmos.yaml | 164 ++++++++++++++ ...custom_entity.test_custom_entity_list.yaml | 112 ++++++---- ...entity.test_custom_entity_list_cosmos.yaml | 208 ++++++++++++++++++ ...ustom_entity.test_custom_entity_query.yaml | 112 ++++++---- ...ntity.test_custom_entity_query_cosmos.yaml | 208 ++++++++++++++++++ ...ustom_entity_async.test_custom_entity.yaml | 85 +++---- ...ntity_async.test_custom_entity_cosmos.yaml | 130 +++++++++++ ..._entity_async.test_custom_entity_list.yaml | 106 +++++---- ..._async.test_custom_entity_list_cosmos.yaml | 166 ++++++++++++++ ...entity_async.test_custom_entity_query.yaml | 106 +++++---- ...async.test_custom_entity_query_cosmos.yaml | 166 ++++++++++++++ .../tests/test_custom_entity.py | 6 +- .../tests/test_custom_entity_async.py | 6 +- 18 files changed, 1424 insertions(+), 265 deletions(-) create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_cosmos.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_list_cosmos.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_query_cosmos.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_cosmos.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_list_cosmos.yaml create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_query_cosmos.yaml 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 89629c41faba..07da48915315 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_models.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_models.py @@ -306,7 +306,7 @@ def _get_next_cb(self, continuation_token, **kwargs): def _extract_data_cb(self, get_next_return): self.location_mode, self._response, self._headers = get_next_return props_list = [ - TableItem._from_generated(t, **self._headers) + TableItem._from_generated(t, **self._headers) # pylint:disable=protected-access for t in self._response.value # pylint:disable=protected-access ] return self._headers[NEXT_TABLE_NAME] or None, props_list @@ -465,9 +465,9 @@ def service_stats_deserialize(generated): def service_properties_deserialize(generated): """Deserialize a ServiceProperties objects into a dict.""" return { - "analytics_logging": TableAnalyticsLogging._from_generated( + "analytics_logging": TableAnalyticsLogging._from_generated( # pylint: disable=protected-access generated.logging - ), # pylint: disable=protected-access + ), "hour_metrics": Metrics._from_generated( # pylint: disable=protected-access generated.hour_metrics ), @@ -475,8 +475,8 @@ def service_properties_deserialize(generated): generated.minute_metrics ), "cors": [ - CorsRule._from_generated(cors) - for cors in generated.cors # pylint: disable=protected-access + CorsRule._from_generated(cors) # pylint: disable=protected-access + for cors in generated.cors ], } 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 a35cee84ccea..acc92c9f86cf 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 @@ -673,7 +673,7 @@ def send_batch( :caption: Using batches to send multiple requests at once """ return self._batch_send( # pylint:disable=protected-access - batch._entities, - *batch._requests, - **kwargs # pylint:disable=protected-access + batch._entities, # pylint:disable=protected-access + *batch._requests, # pylint:disable=protected-access + **kwargs ) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py index ecee119d471a..67238a36077f 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py @@ -60,7 +60,7 @@ async def _get_next_cb(self, continuation_token, **kwargs): async def _extract_data_cb(self, get_next_return): self.location_mode, self._response, self._headers = get_next_return props_list = [ - TableItem._from_generated(t, **self._headers) + TableItem._from_generated(t, **self._headers) # pylint:disable=protected-access for t in self._response.value # pylint:disable=protected-access ] return self._headers[NEXT_TABLE_NAME] or None, props_list 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 72e06b29e132..af9656516c41 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 @@ -690,7 +690,7 @@ async def send_batch( :caption: Using batches to send multiple requests at once """ return await self._batch_send( - batch._entities, - *batch._requests, - **kwargs # pylint:disable=protected-access + batch._entities, # pylint:disable=protected-access + *batch._requests, # pylint:disable=protected-access + **kwargs ) diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity.yaml index a788d6513792..668c96e1ee14 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity.yaml @@ -15,34 +15,38 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:35:46 GMT + - Tue, 26 Jan 2021 21:32:47 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:35:46 GMT + - Tue, 26 Jan 2021 21:32:47 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + uri: https://fake_table_account.table.core.windows.net/Tables response: body: - string: '{"TableName":"uttable27de0f9b","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable27de0f9b"}' headers: + cache-control: + - no-cache content-type: - - application/json;odata=minimalmetadata + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Tue, 26 Jan 2021 15:35:45 GMT - etag: - - W/"datetime'2021-01-26T15%3A35%3A45.3529096Z'" + - Tue, 26 Jan 2021 21:32:45 GMT location: - - https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable27de0f9b') + - https://fake_table_account.table.core.windows.net/Tables('uttable27de0f9b') server: - - Microsoft-HTTPAPI/2.0 + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' status: code: 201 - message: Ok + message: Created - request: body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", @@ -61,31 +65,37 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:35:47 GMT + - Tue, 26 Jan 2021 21:32:48 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:35:47 GMT + - Tue, 26 Jan 2021 21:32:48 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable27de0f9b + uri: https://fake_table_account.table.core.windows.net/uttable27de0f9b response: body: - string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable27de0f9b/$metadata#uttable27de0f9b/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A35%3A45.9355656Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T15:35:45.9355656Z"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable27de0f9b/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A32%3A46.7979523Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T21:32:46.7979523Z","Birthday":"2020-01-01T12:59:59.0123456Z"}' headers: + cache-control: + - no-cache content-type: - - application/json;odata=minimalmetadata + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Tue, 26 Jan 2021 15:35:45 GMT + - Tue, 26 Jan 2021 21:32:46 GMT etag: - - W/"datetime'2021-01-26T15%3A35%3A45.9355656Z'" + - W/"datetime'2021-01-26T21%3A32%3A46.7979523Z'" location: - - https://fake_cosmos_account.table.cosmos.azure.com/uttable27de0f9b(PartitionKey='pk',RowKey='rk') + - https://fake_table_account.table.core.windows.net/uttable27de0f9b(PartitionKey='pk',RowKey='rk') server: - - Microsoft-HTTPAPI/2.0 + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' status: code: 201 message: Created @@ -101,32 +111,38 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:35:47 GMT + - Tue, 26 Jan 2021 21:32:48 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:35:47 GMT + - Tue, 26 Jan 2021 21:32:48 GMT x-ms-version: - '2019-02-02' method: GET - uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable27de0f9b(PartitionKey='pk',RowKey='rk') + uri: https://fake_table_account.table.core.windows.net/uttable27de0f9b(PartitionKey='pk',RowKey='rk') response: body: - string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable27de0f9b/$metadata#uttable27de0f9b/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A35%3A45.9355656Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T15:35:45.9355656Z"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable27de0f9b/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A32%3A46.7979523Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T21:32:46.7979523Z","Birthday":"2020-01-01T12:59:59.0123456Z"}' headers: + cache-control: + - no-cache content-type: - - application/json;odata=minimalmetadata + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Tue, 26 Jan 2021 15:35:45 GMT + - Tue, 26 Jan 2021 21:32:46 GMT etag: - - W/"datetime'2021-01-26T15%3A35%3A45.9355656Z'" + - W/"datetime'2021-01-26T21%3A32%3A46.7979523Z'" server: - - Microsoft-HTTPAPI/2.0 + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' status: code: 200 - message: Ok + message: OK - request: body: null headers: @@ -139,25 +155,31 @@ interactions: Content-Length: - '0' Date: - - Tue, 26 Jan 2021 15:35:47 GMT + - Tue, 26 Jan 2021 21:32:48 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:35:47 GMT + - Tue, 26 Jan 2021 21:32:48 GMT x-ms-version: - '2019-02-02' method: DELETE - uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable27de0f9b') + uri: https://fake_table_account.table.core.windows.net/Tables('uttable27de0f9b') response: body: string: '' headers: + cache-control: + - no-cache content-length: - '0' date: - - Tue, 26 Jan 2021 15:35:46 GMT + - Tue, 26 Jan 2021 21:32:46 GMT server: - - Microsoft-HTTPAPI/2.0 + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' status: code: 204 message: No Content diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_cosmos.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_cosmos.yaml new file mode 100644 index 000000000000..eccadf957c56 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_cosmos.yaml @@ -0,0 +1,164 @@ +interactions: +- request: + body: '{"TableName": "uttablea095128e"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:32:51 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:32:51 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + response: + body: + string: '{"TableName":"uttablea095128e","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Tue, 26 Jan 2021 21:32:51 GMT + etag: + - W/"datetime'2021-01-26T21%3A32%3A50.7638792Z'" + location: + - https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttablea095128e') + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 201 + message: Ok +- request: + body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", + "Birthday@odata.type": "Edm.String"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '195' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:32:52 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:32:52 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttablea095128e + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttablea095128e/$metadata#uttablea095128e/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A32%3A51.3597448Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T21:32:51.3597448Z"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Tue, 26 Jan 2021 21:32:51 GMT + etag: + - W/"datetime'2021-01-26T21%3A32%3A51.3597448Z'" + location: + - https://fake_cosmos_account.table.cosmos.azure.com/uttablea095128e(PartitionKey='pk',RowKey='rk') + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:32:53 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:32:53 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttablea095128e(PartitionKey='pk',RowKey='rk') + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttablea095128e/$metadata#uttablea095128e/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A32%3A51.3597448Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T21:32:51.3597448Z"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Tue, 26 Jan 2021 21:32:51 GMT + etag: + - W/"datetime'2021-01-26T21%3A32%3A51.3597448Z'" + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 200 + message: Ok +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Tue, 26 Jan 2021 21:32:53 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:32:53 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttablea095128e') + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 26 Jan 2021 21:32:52 GMT + server: + - Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_list.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_list.yaml index 9ef05098467b..09dc53aa0f49 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_list.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_list.yaml @@ -15,34 +15,38 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:36:18 GMT + - Tue, 26 Jan 2021 21:32:49 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:36:18 GMT + - Tue, 26 Jan 2021 21:32:49 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + uri: https://fake_table_account.table.core.windows.net/Tables response: body: - string: '{"TableName":"uttable7c0511b6","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable7c0511b6"}' headers: + cache-control: + - no-cache content-type: - - application/json;odata=minimalmetadata + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Tue, 26 Jan 2021 15:36:17 GMT - etag: - - W/"datetime'2021-01-26T15%3A36%3A17.8428936Z'" + - Tue, 26 Jan 2021 21:32:47 GMT location: - - https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable7c0511b6') + - https://fake_table_account.table.core.windows.net/Tables('uttable7c0511b6') server: - - Microsoft-HTTPAPI/2.0 + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' status: code: 201 - message: Ok + message: Created - request: body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", @@ -61,31 +65,37 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:36:20 GMT + - Tue, 26 Jan 2021 21:32:49 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:36:20 GMT + - Tue, 26 Jan 2021 21:32:49 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable7c0511b6 + uri: https://fake_table_account.table.core.windows.net/uttable7c0511b6 response: body: - string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable7c0511b6/$metadata#uttable7c0511b6/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A36%3A18.4824840Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T15:36:18.4824840Z"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable7c0511b6/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A32%3A47.9636278Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T21:32:47.9636278Z","Birthday":"2020-01-01T12:59:59.0123456Z"}' headers: + cache-control: + - no-cache content-type: - - application/json;odata=minimalmetadata + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Tue, 26 Jan 2021 15:36:18 GMT + - Tue, 26 Jan 2021 21:32:47 GMT etag: - - W/"datetime'2021-01-26T15%3A36%3A18.4824840Z'" + - W/"datetime'2021-01-26T21%3A32%3A47.9636278Z'" location: - - https://fake_cosmos_account.table.cosmos.azure.com/uttable7c0511b6(PartitionKey='pk',RowKey='rk') + - https://fake_table_account.table.core.windows.net/uttable7c0511b6(PartitionKey='pk',RowKey='rk') server: - - Microsoft-HTTPAPI/2.0 + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' status: code: 201 message: Created @@ -107,31 +117,37 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:36:20 GMT + - Tue, 26 Jan 2021 21:32:49 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:36:20 GMT + - Tue, 26 Jan 2021 21:32:49 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable7c0511b6 + uri: https://fake_table_account.table.core.windows.net/uttable7c0511b6 response: body: - string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable7c0511b6/$metadata#uttable7c0511b6/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A36%3A18.6268680Z''\"","PartitionKey":"pk","RowKey":"rk1","Birthday":"2021-02-02T12:59:59.0123456Z","Timestamp":"2021-01-26T15:36:18.6268680Z"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable7c0511b6/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A32%3A48.096722Z''\"","PartitionKey":"pk","RowKey":"rk1","Timestamp":"2021-01-26T21:32:48.096722Z","Birthday":"2021-02-02T12:59:59.0123456Z"}' headers: + cache-control: + - no-cache content-type: - - application/json;odata=minimalmetadata + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Tue, 26 Jan 2021 15:36:18 GMT + - Tue, 26 Jan 2021 21:32:47 GMT etag: - - W/"datetime'2021-01-26T15%3A36%3A18.6268680Z'" + - W/"datetime'2021-01-26T21%3A32%3A48.096722Z'" location: - - https://fake_cosmos_account.table.cosmos.azure.com/uttable7c0511b6(PartitionKey='pk',RowKey='rk1') + - https://fake_table_account.table.core.windows.net/uttable7c0511b6(PartitionKey='pk',RowKey='rk1') server: - - Microsoft-HTTPAPI/2.0 + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' status: code: 201 message: Created @@ -147,30 +163,36 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:36:20 GMT + - Tue, 26 Jan 2021 21:32:49 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:36:20 GMT + - Tue, 26 Jan 2021 21:32:49 GMT x-ms-version: - '2019-02-02' method: GET - uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable7c0511b6() + uri: https://fake_table_account.table.core.windows.net/uttable7c0511b6() response: body: - string: '{"value":[{"odata.etag":"W/\"datetime''2021-01-26T15%3A36%3A18.4824840Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T15:36:18.4824840Z"},{"odata.etag":"W/\"datetime''2021-01-26T15%3A36%3A18.6268680Z''\"","PartitionKey":"pk","RowKey":"rk1","Birthday":"2021-02-02T12:59:59.0123456Z","Timestamp":"2021-01-26T15:36:18.6268680Z"}],"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#uttable7c0511b6"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable7c0511b6","value":[{"odata.etag":"W/\"datetime''2021-01-26T21%3A32%3A47.9636278Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T21:32:47.9636278Z","Birthday":"2020-01-01T12:59:59.0123456Z"},{"odata.etag":"W/\"datetime''2021-01-26T21%3A32%3A48.096722Z''\"","PartitionKey":"pk","RowKey":"rk1","Timestamp":"2021-01-26T21:32:48.096722Z","Birthday":"2021-02-02T12:59:59.0123456Z"}]}' headers: + cache-control: + - no-cache content-type: - - application/json;odata=minimalmetadata + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Tue, 26 Jan 2021 15:36:18 GMT + - Tue, 26 Jan 2021 21:32:47 GMT server: - - Microsoft-HTTPAPI/2.0 + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' status: code: 200 - message: Ok + message: OK - request: body: null headers: @@ -183,25 +205,31 @@ interactions: Content-Length: - '0' Date: - - Tue, 26 Jan 2021 15:36:20 GMT + - Tue, 26 Jan 2021 21:32:49 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:36:20 GMT + - Tue, 26 Jan 2021 21:32:49 GMT x-ms-version: - '2019-02-02' method: DELETE - uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable7c0511b6') + uri: https://fake_table_account.table.core.windows.net/Tables('uttable7c0511b6') response: body: string: '' headers: + cache-control: + - no-cache content-length: - '0' date: - - Tue, 26 Jan 2021 15:36:19 GMT + - Tue, 26 Jan 2021 21:32:48 GMT server: - - Microsoft-HTTPAPI/2.0 + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' status: code: 204 message: No Content diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_list_cosmos.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_list_cosmos.yaml new file mode 100644 index 000000000000..4de632728fda --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_list_cosmos.yaml @@ -0,0 +1,208 @@ +interactions: +- request: + body: '{"TableName": "uttable38814a9"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '31' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:33:23 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:33:23 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + response: + body: + string: '{"TableName":"uttable38814a9","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Tue, 26 Jan 2021 21:33:23 GMT + etag: + - W/"datetime'2021-01-26T21%3A33%3A22.8920840Z'" + location: + - https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable38814a9') + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 201 + message: Ok +- request: + body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", + "Birthday@odata.type": "Edm.String"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '195' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:33:24 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:33:24 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable38814a9 + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable38814a9/$metadata#uttable38814a9/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A33%3A23.4154504Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T21:33:23.4154504Z"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Tue, 26 Jan 2021 21:33:23 GMT + etag: + - W/"datetime'2021-01-26T21%3A33%3A23.4154504Z'" + location: + - https://fake_cosmos_account.table.cosmos.azure.com/uttable38814a9(PartitionKey='pk',RowKey='rk') + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk1", "RowKey@odata.type": "Edm.String", "Birthday": "2021-02-02T12:59:59.0123456Z", + "Birthday@odata.type": "Edm.String"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '196' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:33:25 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:33:25 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable38814a9 + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable38814a9/$metadata#uttable38814a9/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A33%3A23.5303432Z''\"","PartitionKey":"pk","RowKey":"rk1","Birthday":"2021-02-02T12:59:59.0123456Z","Timestamp":"2021-01-26T21:33:23.5303432Z"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Tue, 26 Jan 2021 21:33:23 GMT + etag: + - W/"datetime'2021-01-26T21%3A33%3A23.5303432Z'" + location: + - https://fake_cosmos_account.table.cosmos.azure.com/uttable38814a9(PartitionKey='pk',RowKey='rk1') + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:33:25 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:33:25 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable38814a9() + response: + body: + string: '{"value":[{"odata.etag":"W/\"datetime''2021-01-26T21%3A33%3A23.4154504Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T21:33:23.4154504Z"},{"odata.etag":"W/\"datetime''2021-01-26T21%3A33%3A23.5303432Z''\"","PartitionKey":"pk","RowKey":"rk1","Birthday":"2021-02-02T12:59:59.0123456Z","Timestamp":"2021-01-26T21:33:23.5303432Z"}],"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#uttable38814a9"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Tue, 26 Jan 2021 21:33:23 GMT + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 200 + message: Ok +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Tue, 26 Jan 2021 21:33:25 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:33:25 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable38814a9') + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 26 Jan 2021 21:33:25 GMT + server: + - Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_query.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_query.yaml index 5e8ab3d5420e..21c832579610 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_query.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_query.yaml @@ -15,34 +15,38 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:36:51 GMT + - Tue, 26 Jan 2021 21:32:50 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:36:51 GMT + - Tue, 26 Jan 2021 21:32:50 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + uri: https://fake_table_account.table.core.windows.net/Tables response: body: - string: '{"TableName":"uttable8e4f1230","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable8e4f1230"}' headers: + cache-control: + - no-cache content-type: - - application/json;odata=minimalmetadata + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Tue, 26 Jan 2021 15:36:50 GMT - etag: - - W/"datetime'2021-01-26T15%3A36%3A51.1646728Z'" + - Tue, 26 Jan 2021 21:32:48 GMT location: - - https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable8e4f1230') + - https://fake_table_account.table.core.windows.net/Tables('uttable8e4f1230') server: - - Microsoft-HTTPAPI/2.0 + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' status: code: 201 - message: Ok + message: Created - request: body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", @@ -61,31 +65,37 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:36:53 GMT + - Tue, 26 Jan 2021 21:32:50 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:36:53 GMT + - Tue, 26 Jan 2021 21:32:50 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable8e4f1230 + uri: https://fake_table_account.table.core.windows.net/uttable8e4f1230 response: body: - string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable8e4f1230/$metadata#uttable8e4f1230/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A36%3A51.8670344Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Value":20,"Timestamp":"2021-01-26T15:36:51.8670344Z"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable8e4f1230/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A32%3A49.2666264Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T21:32:49.2666264Z","Birthday":"2020-01-01T12:59:59.0123456Z","Value":20}' headers: + cache-control: + - no-cache content-type: - - application/json;odata=minimalmetadata + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Tue, 26 Jan 2021 15:36:51 GMT + - Tue, 26 Jan 2021 21:32:48 GMT etag: - - W/"datetime'2021-01-26T15%3A36%3A51.8670344Z'" + - W/"datetime'2021-01-26T21%3A32%3A49.2666264Z'" location: - - https://fake_cosmos_account.table.cosmos.azure.com/uttable8e4f1230(PartitionKey='pk',RowKey='rk') + - https://fake_table_account.table.core.windows.net/uttable8e4f1230(PartitionKey='pk',RowKey='rk') server: - - Microsoft-HTTPAPI/2.0 + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' status: code: 201 message: Created @@ -107,31 +117,37 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:36:53 GMT + - Tue, 26 Jan 2021 21:32:50 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:36:53 GMT + - Tue, 26 Jan 2021 21:32:50 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable8e4f1230 + uri: https://fake_table_account.table.core.windows.net/uttable8e4f1230 response: body: - string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable8e4f1230/$metadata#uttable8e4f1230/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A36%3A52.0079368Z''\"","PartitionKey":"pk","RowKey":"rk1","Birthday":"2021-02-02T12:59:59.0123456Z","Value":30,"Timestamp":"2021-01-26T15:36:52.0079368Z"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable8e4f1230/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A32%3A49.3977196Z''\"","PartitionKey":"pk","RowKey":"rk1","Timestamp":"2021-01-26T21:32:49.3977196Z","Birthday":"2021-02-02T12:59:59.0123456Z","Value":30}' headers: + cache-control: + - no-cache content-type: - - application/json;odata=minimalmetadata + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Tue, 26 Jan 2021 15:36:51 GMT + - Tue, 26 Jan 2021 21:32:48 GMT etag: - - W/"datetime'2021-01-26T15%3A36%3A52.0079368Z'" + - W/"datetime'2021-01-26T21%3A32%3A49.3977196Z'" location: - - https://fake_cosmos_account.table.cosmos.azure.com/uttable8e4f1230(PartitionKey='pk',RowKey='rk1') + - https://fake_table_account.table.core.windows.net/uttable8e4f1230(PartitionKey='pk',RowKey='rk1') server: - - Microsoft-HTTPAPI/2.0 + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' status: code: 201 message: Created @@ -147,30 +163,36 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:36:53 GMT + - Tue, 26 Jan 2021 21:32:51 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:36:53 GMT + - Tue, 26 Jan 2021 21:32:51 GMT x-ms-version: - '2019-02-02' method: GET - uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable8e4f1230()?$filter=Value%20lt%2025 + uri: https://fake_table_account.table.core.windows.net/uttable8e4f1230()?$filter=Value%20lt%2025 response: body: - string: '{"value":[{"odata.etag":"W/\"datetime''2021-01-26T15%3A36%3A51.8670344Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Value":20,"Timestamp":"2021-01-26T15:36:51.8670344Z"}],"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#uttable8e4f1230"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable8e4f1230","value":[{"odata.etag":"W/\"datetime''2021-01-26T21%3A32%3A49.2666264Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T21:32:49.2666264Z","Birthday":"2020-01-01T12:59:59.0123456Z","Value":20}]}' headers: + cache-control: + - no-cache content-type: - - application/json;odata=minimalmetadata + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Tue, 26 Jan 2021 15:36:51 GMT + - Tue, 26 Jan 2021 21:32:48 GMT server: - - Microsoft-HTTPAPI/2.0 + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' status: code: 200 - message: Ok + message: OK - request: body: null headers: @@ -183,25 +205,31 @@ interactions: Content-Length: - '0' Date: - - Tue, 26 Jan 2021 15:36:53 GMT + - Tue, 26 Jan 2021 21:32:51 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:36:53 GMT + - Tue, 26 Jan 2021 21:32:51 GMT x-ms-version: - '2019-02-02' method: DELETE - uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable8e4f1230') + uri: https://fake_table_account.table.core.windows.net/Tables('uttable8e4f1230') response: body: string: '' headers: + cache-control: + - no-cache content-length: - '0' date: - - Tue, 26 Jan 2021 15:36:52 GMT + - Tue, 26 Jan 2021 21:32:49 GMT server: - - Microsoft-HTTPAPI/2.0 + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' status: code: 204 message: No Content diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_query_cosmos.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_query_cosmos.yaml new file mode 100644 index 000000000000..df673023c51d --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_query_cosmos.yaml @@ -0,0 +1,208 @@ +interactions: +- request: + body: '{"TableName": "uttable19281523"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:33:57 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:33:57 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + response: + body: + string: '{"TableName":"uttable19281523","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Tue, 26 Jan 2021 21:33:55 GMT + etag: + - W/"datetime'2021-01-26T21%3A33%3A56.4994568Z'" + location: + - https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable19281523') + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 201 + message: Ok +- request: + body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", + "Birthday@odata.type": "Edm.String", "Value": 20}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '208' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:33:58 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:33:58 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable19281523 + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable19281523/$metadata#uttable19281523/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A33%3A57.0668552Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Value":20,"Timestamp":"2021-01-26T21:33:57.0668552Z"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Tue, 26 Jan 2021 21:33:57 GMT + etag: + - W/"datetime'2021-01-26T21%3A33%3A57.0668552Z'" + location: + - https://fake_cosmos_account.table.cosmos.azure.com/uttable19281523(PartitionKey='pk',RowKey='rk') + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk1", "RowKey@odata.type": "Edm.String", "Birthday": "2021-02-02T12:59:59.0123456Z", + "Birthday@odata.type": "Edm.String", "Value": 30}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '209' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:33:58 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:33:58 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable19281523 + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable19281523/$metadata#uttable19281523/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A33%3A57.2022280Z''\"","PartitionKey":"pk","RowKey":"rk1","Birthday":"2021-02-02T12:59:59.0123456Z","Value":30,"Timestamp":"2021-01-26T21:33:57.2022280Z"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Tue, 26 Jan 2021 21:33:57 GMT + etag: + - W/"datetime'2021-01-26T21%3A33%3A57.2022280Z'" + location: + - https://fake_cosmos_account.table.cosmos.azure.com/uttable19281523(PartitionKey='pk',RowKey='rk1') + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:33:58 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:33:58 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable19281523()?$filter=Value%20lt%2025 + response: + body: + string: '{"value":[{"odata.etag":"W/\"datetime''2021-01-26T21%3A33%3A57.0668552Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Value":20,"Timestamp":"2021-01-26T21:33:57.0668552Z"}],"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#uttable19281523"}' + headers: + content-type: + - application/json;odata=minimalmetadata + date: + - Tue, 26 Jan 2021 21:33:57 GMT + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 200 + message: Ok +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Tue, 26 Jan 2021 21:33:59 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:33:59 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable19281523') + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 26 Jan 2021 21:33:57 GMT + server: + - Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity.yaml index 686c8e08d1c0..f70acc63310b 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity.yaml @@ -11,29 +11,31 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:53:23 GMT + - Tue, 26 Jan 2021 21:34:29 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:53:23 GMT + - Tue, 26 Jan 2021 21:34:29 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + uri: https://fake_table_account.table.core.windows.net/Tables response: body: - string: '{"TableName":"uttable8e041218","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable8e041218"}' headers: - content-type: application/json;odata=minimalmetadata - date: Tue, 26 Jan 2021 15:53:21 GMT - etag: W/"datetime'2021-01-26T15%3A53%3A22.0158472Z'" - location: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable8e041218') - server: Microsoft-HTTPAPI/2.0 + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Tue, 26 Jan 2021 21:34:27 GMT + location: https://fake_table_account.table.core.windows.net/Tables('uttable8e041218') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-02-02' status: code: 201 - message: Ok - url: https://seankaneprim.table.cosmos.azure.com/Tables + message: Created + url: https://seankaneprim.table.core.windows.net/Tables - request: body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", @@ -48,29 +50,32 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:53:24 GMT + - Tue, 26 Jan 2021 21:34:30 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:53:24 GMT + - Tue, 26 Jan 2021 21:34:30 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable8e041218 + uri: https://fake_table_account.table.core.windows.net/uttable8e041218 response: body: - string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable8e041218/$metadata#uttable8e041218/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A53%3A22.6231816Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T15:53:22.6231816Z"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable8e041218/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A34%3A28.9413147Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T21:34:28.9413147Z","Birthday":"2020-01-01T12:59:59.0123456Z"}' headers: - content-type: application/json;odata=minimalmetadata - date: Tue, 26 Jan 2021 15:53:21 GMT - etag: W/"datetime'2021-01-26T15%3A53%3A22.6231816Z'" - location: https://fake_cosmos_account.table.cosmos.azure.com/uttable8e041218(PartitionKey='pk',RowKey='rk') - server: Microsoft-HTTPAPI/2.0 + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Tue, 26 Jan 2021 21:34:28 GMT + etag: W/"datetime'2021-01-26T21%3A34%3A28.9413147Z'" + location: https://fake_table_account.table.core.windows.net/uttable8e041218(PartitionKey='pk',RowKey='rk') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-02-02' status: code: 201 message: Created - url: https://seankaneprim.table.cosmos.azure.com/uttable8e041218 + url: https://seankaneprim.table.core.windows.net/uttable8e041218 - request: body: null headers: @@ -79,52 +84,58 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:53:24 GMT + - Tue, 26 Jan 2021 21:34:30 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:53:24 GMT + - Tue, 26 Jan 2021 21:34:30 GMT x-ms-version: - '2019-02-02' method: GET - uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable8e041218(PartitionKey='pk',RowKey='rk') + uri: https://fake_table_account.table.core.windows.net/uttable8e041218(PartitionKey='pk',RowKey='rk') response: body: - string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable8e041218/$metadata#uttable8e041218/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A53%3A22.6231816Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T15:53:22.6231816Z"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable8e041218/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A34%3A28.9413147Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T21:34:28.9413147Z","Birthday":"2020-01-01T12:59:59.0123456Z"}' headers: - content-type: application/json;odata=minimalmetadata - date: Tue, 26 Jan 2021 15:53:21 GMT - etag: W/"datetime'2021-01-26T15%3A53%3A22.6231816Z'" - server: Microsoft-HTTPAPI/2.0 + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Tue, 26 Jan 2021 21:34:28 GMT + etag: W/"datetime'2021-01-26T21%3A34%3A28.9413147Z'" + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-02-02' status: code: 200 - message: Ok - url: https://seankaneprim.table.cosmos.azure.com/uttable8e041218(PartitionKey='pk',RowKey='rk') + message: OK + url: https://seankaneprim.table.core.windows.net/uttable8e041218(PartitionKey='pk',RowKey='rk') - request: body: null headers: Accept: - application/json Date: - - Tue, 26 Jan 2021 15:53:24 GMT + - Tue, 26 Jan 2021 21:34:30 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:53:24 GMT + - Tue, 26 Jan 2021 21:34:30 GMT x-ms-version: - '2019-02-02' method: DELETE - uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable8e041218') + uri: https://fake_table_account.table.core.windows.net/Tables('uttable8e041218') response: body: string: '' headers: + cache-control: no-cache content-length: '0' - date: Tue, 26 Jan 2021 15:53:23 GMT - server: Microsoft-HTTPAPI/2.0 + date: Tue, 26 Jan 2021 21:34:29 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-02-02' status: code: 204 message: No Content - url: https://seankaneprim.table.cosmos.azure.com/Tables('uttable8e041218') + url: https://seankaneprim.table.core.windows.net/Tables('uttable8e041218') version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_cosmos.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_cosmos.yaml new file mode 100644 index 000000000000..cb43d7b23358 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_cosmos.yaml @@ -0,0 +1,130 @@ +interactions: +- request: + body: '{"TableName": "uttable1835150b"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:34:33 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:34:33 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + response: + body: + string: '{"TableName":"uttable1835150b","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 21:34:32 GMT + etag: W/"datetime'2021-01-26T21%3A34%3A32.5238792Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable1835150b') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Ok + url: https://seankaneprim.table.cosmos.azure.com/Tables +- request: + body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", + "Birthday@odata.type": "Edm.String"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '195' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:34:34 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:34:34 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable1835150b + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable1835150b/$metadata#uttable1835150b/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A34%3A33.0663944Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T21:34:33.0663944Z"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 21:34:32 GMT + etag: W/"datetime'2021-01-26T21%3A34%3A33.0663944Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/uttable1835150b(PartitionKey='pk',RowKey='rk') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://seankaneprim.table.cosmos.azure.com/uttable1835150b +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:34:34 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:34:34 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable1835150b(PartitionKey='pk',RowKey='rk') + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable1835150b/$metadata#uttable1835150b/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A34%3A33.0663944Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T21:34:33.0663944Z"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 21:34:32 GMT + etag: W/"datetime'2021-01-26T21%3A34%3A33.0663944Z'" + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 200 + message: Ok + url: https://seankaneprim.table.cosmos.azure.com/uttable1835150b(PartitionKey='pk',RowKey='rk') +- request: + body: null + headers: + Accept: + - application/json + Date: + - Tue, 26 Jan 2021 21:34:34 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:34:34 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable1835150b') + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 26 Jan 2021 21:34:33 GMT + server: Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content + url: https://seankaneprim.table.cosmos.azure.com/Tables('uttable1835150b') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_list.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_list.yaml index 3103d4329c70..d8dcee28b4b6 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_list.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_list.yaml @@ -11,29 +11,31 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:53:55 GMT + - Tue, 26 Jan 2021 21:34:31 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:53:55 GMT + - Tue, 26 Jan 2021 21:34:31 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + uri: https://fake_table_account.table.core.windows.net/Tables response: body: - string: '{"TableName":"uttableee9c1433","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttableee9c1433"}' headers: - content-type: application/json;odata=minimalmetadata - date: Tue, 26 Jan 2021 15:53:54 GMT - etag: W/"datetime'2021-01-26T15%3A53%3A54.3972872Z'" - location: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttableee9c1433') - server: Microsoft-HTTPAPI/2.0 + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Tue, 26 Jan 2021 21:34:29 GMT + location: https://fake_table_account.table.core.windows.net/Tables('uttableee9c1433') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-02-02' status: code: 201 - message: Ok - url: https://seankaneprim.table.cosmos.azure.com/Tables + message: Created + url: https://seankaneprim.table.core.windows.net/Tables - request: body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", @@ -48,29 +50,32 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:53:56 GMT + - Tue, 26 Jan 2021 21:34:31 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:53:56 GMT + - Tue, 26 Jan 2021 21:34:31 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_cosmos_account.table.cosmos.azure.com/uttableee9c1433 + uri: https://fake_table_account.table.core.windows.net/uttableee9c1433 response: body: - string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttableee9c1433/$metadata#uttableee9c1433/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A53%3A55.1277064Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T15:53:55.1277064Z"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttableee9c1433/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A34%3A30.0478065Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T21:34:30.0478065Z","Birthday":"2020-01-01T12:59:59.0123456Z"}' headers: - content-type: application/json;odata=minimalmetadata - date: Tue, 26 Jan 2021 15:53:54 GMT - etag: W/"datetime'2021-01-26T15%3A53%3A55.1277064Z'" - location: https://fake_cosmos_account.table.cosmos.azure.com/uttableee9c1433(PartitionKey='pk',RowKey='rk') - server: Microsoft-HTTPAPI/2.0 + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Tue, 26 Jan 2021 21:34:29 GMT + etag: W/"datetime'2021-01-26T21%3A34%3A30.0478065Z'" + location: https://fake_table_account.table.core.windows.net/uttableee9c1433(PartitionKey='pk',RowKey='rk') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-02-02' status: code: 201 message: Created - url: https://seankaneprim.table.cosmos.azure.com/uttableee9c1433 + url: https://seankaneprim.table.core.windows.net/uttableee9c1433 - request: body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": "rk1", "RowKey@odata.type": "Edm.String", "Birthday": "2021-02-02T12:59:59.0123456Z", @@ -85,29 +90,32 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:53:56 GMT + - Tue, 26 Jan 2021 21:34:31 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:53:56 GMT + - Tue, 26 Jan 2021 21:34:31 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_cosmos_account.table.cosmos.azure.com/uttableee9c1433 + uri: https://fake_table_account.table.core.windows.net/uttableee9c1433 response: body: - string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttableee9c1433/$metadata#uttableee9c1433/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A53%3A55.2427016Z''\"","PartitionKey":"pk","RowKey":"rk1","Birthday":"2021-02-02T12:59:59.0123456Z","Timestamp":"2021-01-26T15:53:55.2427016Z"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttableee9c1433/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A34%3A30.1608867Z''\"","PartitionKey":"pk","RowKey":"rk1","Timestamp":"2021-01-26T21:34:30.1608867Z","Birthday":"2021-02-02T12:59:59.0123456Z"}' headers: - content-type: application/json;odata=minimalmetadata - date: Tue, 26 Jan 2021 15:53:54 GMT - etag: W/"datetime'2021-01-26T15%3A53%3A55.2427016Z'" - location: https://fake_cosmos_account.table.cosmos.azure.com/uttableee9c1433(PartitionKey='pk',RowKey='rk1') - server: Microsoft-HTTPAPI/2.0 + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Tue, 26 Jan 2021 21:34:29 GMT + etag: W/"datetime'2021-01-26T21%3A34%3A30.1608867Z'" + location: https://fake_table_account.table.core.windows.net/uttableee9c1433(PartitionKey='pk',RowKey='rk1') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-02-02' status: code: 201 message: Created - url: https://seankaneprim.table.cosmos.azure.com/uttableee9c1433 + url: https://seankaneprim.table.core.windows.net/uttableee9c1433 - request: body: null headers: @@ -116,51 +124,57 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:53:57 GMT + - Tue, 26 Jan 2021 21:34:31 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:53:57 GMT + - Tue, 26 Jan 2021 21:34:31 GMT x-ms-version: - '2019-02-02' method: GET - uri: https://fake_cosmos_account.table.cosmos.azure.com/uttableee9c1433() + uri: https://fake_table_account.table.core.windows.net/uttableee9c1433() response: body: - string: '{"value":[{"odata.etag":"W/\"datetime''2021-01-26T15%3A53%3A55.1277064Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T15:53:55.1277064Z"},{"odata.etag":"W/\"datetime''2021-01-26T15%3A53%3A55.2427016Z''\"","PartitionKey":"pk","RowKey":"rk1","Birthday":"2021-02-02T12:59:59.0123456Z","Timestamp":"2021-01-26T15:53:55.2427016Z"}],"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#uttableee9c1433"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttableee9c1433","value":[{"odata.etag":"W/\"datetime''2021-01-26T21%3A34%3A30.0478065Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T21:34:30.0478065Z","Birthday":"2020-01-01T12:59:59.0123456Z"},{"odata.etag":"W/\"datetime''2021-01-26T21%3A34%3A30.1608867Z''\"","PartitionKey":"pk","RowKey":"rk1","Timestamp":"2021-01-26T21:34:30.1608867Z","Birthday":"2021-02-02T12:59:59.0123456Z"}]}' headers: - content-type: application/json;odata=minimalmetadata - date: Tue, 26 Jan 2021 15:53:54 GMT - server: Microsoft-HTTPAPI/2.0 + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Tue, 26 Jan 2021 21:34:29 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-02-02' status: code: 200 - message: Ok - url: https://seankaneprim.table.cosmos.azure.com/uttableee9c1433() + message: OK + url: https://seankaneprim.table.core.windows.net/uttableee9c1433() - request: body: null headers: Accept: - application/json Date: - - Tue, 26 Jan 2021 15:53:57 GMT + - Tue, 26 Jan 2021 21:34:31 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:53:57 GMT + - Tue, 26 Jan 2021 21:34:31 GMT x-ms-version: - '2019-02-02' method: DELETE - uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttableee9c1433') + uri: https://fake_table_account.table.core.windows.net/Tables('uttableee9c1433') response: body: string: '' headers: + cache-control: no-cache content-length: '0' - date: Tue, 26 Jan 2021 15:53:56 GMT - server: Microsoft-HTTPAPI/2.0 + date: Tue, 26 Jan 2021 21:34:30 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-02-02' status: code: 204 message: No Content - url: https://seankaneprim.table.cosmos.azure.com/Tables('uttableee9c1433') + url: https://seankaneprim.table.core.windows.net/Tables('uttableee9c1433') version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_list_cosmos.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_list_cosmos.yaml new file mode 100644 index 000000000000..4c9c0dc9e5c2 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_list_cosmos.yaml @@ -0,0 +1,166 @@ +interactions: +- request: + body: '{"TableName": "uttable878a1726"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:35:05 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:35:05 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + response: + body: + string: '{"TableName":"uttable878a1726","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 21:35:05 GMT + etag: W/"datetime'2021-01-26T21%3A35%3A04.9680904Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable878a1726') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Ok + url: https://seankaneprim.table.cosmos.azure.com/Tables +- request: + body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", + "Birthday@odata.type": "Edm.String"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '195' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:35:07 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:35:07 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable878a1726 + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable878a1726/$metadata#uttable878a1726/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A35%3A05.7252360Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T21:35:05.7252360Z"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 21:35:05 GMT + etag: W/"datetime'2021-01-26T21%3A35%3A05.7252360Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/uttable878a1726(PartitionKey='pk',RowKey='rk') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://seankaneprim.table.cosmos.azure.com/uttable878a1726 +- request: + body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk1", "RowKey@odata.type": "Edm.String", "Birthday": "2021-02-02T12:59:59.0123456Z", + "Birthday@odata.type": "Edm.String"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '196' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:35:07 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:35:07 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable878a1726 + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable878a1726/$metadata#uttable878a1726/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A35%3A05.8412552Z''\"","PartitionKey":"pk","RowKey":"rk1","Birthday":"2021-02-02T12:59:59.0123456Z","Timestamp":"2021-01-26T21:35:05.8412552Z"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 21:35:05 GMT + etag: W/"datetime'2021-01-26T21%3A35%3A05.8412552Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/uttable878a1726(PartitionKey='pk',RowKey='rk1') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://seankaneprim.table.cosmos.azure.com/uttable878a1726 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:35:07 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:35:07 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable878a1726() + response: + body: + string: '{"value":[{"odata.etag":"W/\"datetime''2021-01-26T21%3A35%3A05.7252360Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Timestamp":"2021-01-26T21:35:05.7252360Z"},{"odata.etag":"W/\"datetime''2021-01-26T21%3A35%3A05.8412552Z''\"","PartitionKey":"pk","RowKey":"rk1","Birthday":"2021-02-02T12:59:59.0123456Z","Timestamp":"2021-01-26T21:35:05.8412552Z"}],"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#uttable878a1726"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 21:35:05 GMT + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 200 + message: Ok + url: https://seankaneprim.table.cosmos.azure.com/uttable878a1726() +- request: + body: null + headers: + Accept: + - application/json + Date: + - Tue, 26 Jan 2021 21:35:07 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:35:07 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable878a1726') + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 26 Jan 2021 21:35:07 GMT + server: Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content + url: https://seankaneprim.table.cosmos.azure.com/Tables('uttable878a1726') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_query.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_query.yaml index 4fc014a24729..561e7c452bce 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_query.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_query.yaml @@ -11,29 +11,31 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:54:28 GMT + - Tue, 26 Jan 2021 21:34:32 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:54:28 GMT + - Tue, 26 Jan 2021 21:34:32 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + uri: https://fake_table_account.table.core.windows.net/Tables response: body: - string: '{"TableName":"uttable37214ad","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttable37214ad"}' headers: - content-type: application/json;odata=minimalmetadata - date: Tue, 26 Jan 2021 15:54:27 GMT - etag: W/"datetime'2021-01-26T15%3A54%3A26.9238280Z'" - location: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable37214ad') - server: Microsoft-HTTPAPI/2.0 + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Tue, 26 Jan 2021 21:34:30 GMT + location: https://fake_table_account.table.core.windows.net/Tables('uttable37214ad') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-02-02' status: code: 201 - message: Ok - url: https://seankaneprim.table.cosmos.azure.com/Tables + message: Created + url: https://seankaneprim.table.core.windows.net/Tables - request: body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", @@ -48,29 +50,32 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:54:29 GMT + - Tue, 26 Jan 2021 21:34:32 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:54:29 GMT + - Tue, 26 Jan 2021 21:34:32 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable37214ad + uri: https://fake_table_account.table.core.windows.net/uttable37214ad response: body: - string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable37214ad/$metadata#uttable37214ad/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A54%3A27.7315592Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Value":20,"Timestamp":"2021-01-26T15:54:27.7315592Z"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable37214ad/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A34%3A31.2484779Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T21:34:31.2484779Z","Birthday":"2020-01-01T12:59:59.0123456Z","Value":20}' headers: - content-type: application/json;odata=minimalmetadata - date: Tue, 26 Jan 2021 15:54:27 GMT - etag: W/"datetime'2021-01-26T15%3A54%3A27.7315592Z'" - location: https://fake_cosmos_account.table.cosmos.azure.com/uttable37214ad(PartitionKey='pk',RowKey='rk') - server: Microsoft-HTTPAPI/2.0 + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Tue, 26 Jan 2021 21:34:30 GMT + etag: W/"datetime'2021-01-26T21%3A34%3A31.2484779Z'" + location: https://fake_table_account.table.core.windows.net/uttable37214ad(PartitionKey='pk',RowKey='rk') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-02-02' status: code: 201 message: Created - url: https://seankaneprim.table.cosmos.azure.com/uttable37214ad + url: https://seankaneprim.table.core.windows.net/uttable37214ad - request: body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": "rk1", "RowKey@odata.type": "Edm.String", "Birthday": "2021-02-02T12:59:59.0123456Z", @@ -85,29 +90,32 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:54:29 GMT + - Tue, 26 Jan 2021 21:34:32 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:54:29 GMT + - Tue, 26 Jan 2021 21:34:32 GMT x-ms-version: - '2019-02-02' method: POST - uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable37214ad + uri: https://fake_table_account.table.core.windows.net/uttable37214ad response: body: - string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable37214ad/$metadata#uttable37214ad/@Element","odata.etag":"W/\"datetime''2021-01-26T15%3A54%3A27.8456328Z''\"","PartitionKey":"pk","RowKey":"rk1","Birthday":"2021-02-02T12:59:59.0123456Z","Value":30,"Timestamp":"2021-01-26T15:54:27.8456328Z"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable37214ad/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A34%3A31.3515521Z''\"","PartitionKey":"pk","RowKey":"rk1","Timestamp":"2021-01-26T21:34:31.3515521Z","Birthday":"2021-02-02T12:59:59.0123456Z","Value":30}' headers: - content-type: application/json;odata=minimalmetadata - date: Tue, 26 Jan 2021 15:54:27 GMT - etag: W/"datetime'2021-01-26T15%3A54%3A27.8456328Z'" - location: https://fake_cosmos_account.table.cosmos.azure.com/uttable37214ad(PartitionKey='pk',RowKey='rk1') - server: Microsoft-HTTPAPI/2.0 + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Tue, 26 Jan 2021 21:34:30 GMT + etag: W/"datetime'2021-01-26T21%3A34%3A31.3515521Z'" + location: https://fake_table_account.table.core.windows.net/uttable37214ad(PartitionKey='pk',RowKey='rk1') + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-02-02' status: code: 201 message: Created - url: https://seankaneprim.table.cosmos.azure.com/uttable37214ad + url: https://seankaneprim.table.core.windows.net/uttable37214ad - request: body: null headers: @@ -116,51 +124,57 @@ interactions: DataServiceVersion: - '3.0' Date: - - Tue, 26 Jan 2021 15:54:29 GMT + - Tue, 26 Jan 2021 21:34:33 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:54:29 GMT + - Tue, 26 Jan 2021 21:34:33 GMT x-ms-version: - '2019-02-02' method: GET - uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable37214ad()?$filter=Value%20lt%2025 + uri: https://fake_table_account.table.core.windows.net/uttable37214ad()?$filter=Value%20lt%2025 response: body: - string: '{"value":[{"odata.etag":"W/\"datetime''2021-01-26T15%3A54%3A27.7315592Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Value":20,"Timestamp":"2021-01-26T15:54:27.7315592Z"}],"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#uttable37214ad"}' + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttable37214ad","value":[{"odata.etag":"W/\"datetime''2021-01-26T21%3A34%3A31.2484779Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-01-26T21:34:31.2484779Z","Birthday":"2020-01-01T12:59:59.0123456Z","Value":20}]}' headers: - content-type: application/json;odata=minimalmetadata - date: Tue, 26 Jan 2021 15:54:27 GMT - server: Microsoft-HTTPAPI/2.0 + cache-control: no-cache + content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: Tue, 26 Jan 2021 21:34:30 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 transfer-encoding: chunked + x-content-type-options: nosniff + x-ms-version: '2019-02-02' status: code: 200 - message: Ok - url: https://seankaneprim.table.cosmos.azure.com/uttable37214ad()?$filter=Value%20lt%2025 + message: OK + url: https://seankaneprim.table.core.windows.net/uttable37214ad()?$filter=Value%20lt%2025 - request: body: null headers: Accept: - application/json Date: - - Tue, 26 Jan 2021 15:54:29 GMT + - Tue, 26 Jan 2021 21:34:33 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Tue, 26 Jan 2021 15:54:29 GMT + - Tue, 26 Jan 2021 21:34:33 GMT x-ms-version: - '2019-02-02' method: DELETE - uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable37214ad') + uri: https://fake_table_account.table.core.windows.net/Tables('uttable37214ad') response: body: string: '' headers: + cache-control: no-cache content-length: '0' - date: Tue, 26 Jan 2021 15:54:28 GMT - server: Microsoft-HTTPAPI/2.0 + date: Tue, 26 Jan 2021 21:34:31 GMT + server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: nosniff + x-ms-version: '2019-02-02' status: code: 204 message: No Content - url: https://seankaneprim.table.cosmos.azure.com/Tables('uttable37214ad') + url: https://seankaneprim.table.core.windows.net/Tables('uttable37214ad') version: 1 diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_query_cosmos.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_query_cosmos.yaml new file mode 100644 index 000000000000..f6d41aaeb39f --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity_async.test_custom_entity_query_cosmos.yaml @@ -0,0 +1,166 @@ +interactions: +- request: + body: '{"TableName": "uttable9fa717a0"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:35:39 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:35:39 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables + response: + body: + string: '{"TableName":"uttable9fa717a0","odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#Tables/@Element"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 21:35:38 GMT + etag: W/"datetime'2021-01-26T21%3A35%3A38.1416968Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable9fa717a0') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Ok + url: https://seankaneprim.table.cosmos.azure.com/Tables +- request: + body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", + "Birthday@odata.type": "Edm.String", "Value": 20}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '208' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:35:40 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:35:40 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable9fa717a0 + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable9fa717a0/$metadata#uttable9fa717a0/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A35%3A38.7530248Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Value":20,"Timestamp":"2021-01-26T21:35:38.7530248Z"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 21:35:38 GMT + etag: W/"datetime'2021-01-26T21%3A35%3A38.7530248Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/uttable9fa717a0(PartitionKey='pk',RowKey='rk') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://seankaneprim.table.cosmos.azure.com/uttable9fa717a0 +- request: + body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk1", "RowKey@odata.type": "Edm.String", "Birthday": "2021-02-02T12:59:59.0123456Z", + "Birthday@odata.type": "Edm.String", "Value": 30}' + headers: + Accept: + - application/json;odata=minimalmetadata + Content-Length: + - '209' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:35:40 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:35:40 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable9fa717a0 + response: + body: + string: '{"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/uttable9fa717a0/$metadata#uttable9fa717a0/@Element","odata.etag":"W/\"datetime''2021-01-26T21%3A35%3A38.8644360Z''\"","PartitionKey":"pk","RowKey":"rk1","Birthday":"2021-02-02T12:59:59.0123456Z","Value":30,"Timestamp":"2021-01-26T21:35:38.8644360Z"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 21:35:38 GMT + etag: W/"datetime'2021-01-26T21%3A35%3A38.8644360Z'" + location: https://fake_cosmos_account.table.cosmos.azure.com/uttable9fa717a0(PartitionKey='pk',RowKey='rk1') + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://seankaneprim.table.cosmos.azure.com/uttable9fa717a0 +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + DataServiceVersion: + - '3.0' + Date: + - Tue, 26 Jan 2021 21:35:40 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:35:40 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_cosmos_account.table.cosmos.azure.com/uttable9fa717a0()?$filter=Value%20lt%2025 + response: + body: + string: '{"value":[{"odata.etag":"W/\"datetime''2021-01-26T21%3A35%3A38.7530248Z''\"","PartitionKey":"pk","RowKey":"rk","Birthday":"2020-01-01T12:59:59.0123456Z","Value":20,"Timestamp":"2021-01-26T21:35:38.7530248Z"}],"odata.metadata":"https://fake_cosmos_account.table.cosmos.azure.com/$metadata#uttable9fa717a0"}' + headers: + content-type: application/json;odata=minimalmetadata + date: Tue, 26 Jan 2021 21:35:38 GMT + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 200 + message: Ok + url: https://seankaneprim.table.cosmos.azure.com/uttable9fa717a0()?$filter=Value%20lt%2025 +- request: + body: null + headers: + Accept: + - application/json + Date: + - Tue, 26 Jan 2021 21:35:40 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Tue, 26 Jan 2021 21:35:40 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_cosmos_account.table.cosmos.azure.com/Tables('uttable9fa717a0') + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 26 Jan 2021 21:35:39 GMT + server: Microsoft-HTTPAPI/2.0 + status: + code: 204 + message: No Content + url: https://seankaneprim.table.cosmos.azure.com/Tables('uttable9fa717a0') +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/test_custom_entity.py b/sdk/tables/azure-data-tables/tests/test_custom_entity.py index a6f77628420d..897545908579 100644 --- a/sdk/tables/azure-data-tables/tests/test_custom_entity.py +++ b/sdk/tables/azure-data-tables/tests/test_custom_entity.py @@ -309,7 +309,7 @@ def _tear_down( self.sleep(SLEEP_DELAY) @CosmosPreparer() - def test_custom_entity( + def test_custom_entity_cosmos( self, tables_cosmos_account_name, tables_primary_cosmos_account_key ): table_client = self._set_up( @@ -341,7 +341,7 @@ def test_custom_entity( ) @CosmosPreparer() - def test_custom_entity_list( + def test_custom_entity_list_cosmos( self, tables_cosmos_account_name, tables_primary_cosmos_account_key ): table_client = self._set_up( @@ -378,7 +378,7 @@ def test_custom_entity_list( ) @CosmosPreparer() - def test_custom_entity_query( + def test_custom_entity_query_cosmos( self, tables_cosmos_account_name, tables_primary_cosmos_account_key ): table_client = self._set_up( diff --git a/sdk/tables/azure-data-tables/tests/test_custom_entity_async.py b/sdk/tables/azure-data-tables/tests/test_custom_entity_async.py index 88d5f41f5b07..16ae107b3ac0 100644 --- a/sdk/tables/azure-data-tables/tests/test_custom_entity_async.py +++ b/sdk/tables/azure-data-tables/tests/test_custom_entity_async.py @@ -317,7 +317,7 @@ async def _tear_down( self.sleep(SLEEP_DELAY) @CosmosPreparer() - async def test_custom_entity( + async def test_custom_entity_cosmos( self, tables_cosmos_account_name, tables_primary_cosmos_account_key ): table_client = await self._set_up( @@ -349,7 +349,7 @@ async def test_custom_entity( ) @CosmosPreparer() - async def test_custom_entity_list( + async def test_custom_entity_list_cosmos( self, tables_cosmos_account_name, tables_primary_cosmos_account_key ): table_client = await self._set_up( @@ -387,7 +387,7 @@ async def test_custom_entity_list( ) @CosmosPreparer() - async def test_custom_entity_query( + async def test_custom_entity_query_cosmos( self, tables_cosmos_account_name, tables_primary_cosmos_account_key ): table_client = await self._set_up( From 60ce69cee36bae7abbe63db1f4cddb3f0b756a54 Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Thu, 11 Feb 2021 13:26:45 -0500 Subject: [PATCH 5/7] addressing anna comments --- .../azure/data/tables/_models.py | 6 +- .../azure/data/tables/_table_client.py | 22 ++--- .../azure/data/tables/aio/_models.py | 2 +- .../data/tables/aio/_table_client_async.py | 26 ++---- ...tom_entity.test_custom_entity_edmtype.yaml | 90 +++++++++++++++++++ .../tests/test_custom_entity.py | 37 ++++++++ 6 files changed, 148 insertions(+), 35 deletions(-) create mode 100644 sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_edmtype.yaml 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 07da48915315..c3bf126ad606 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_models.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_models.py @@ -323,7 +323,7 @@ class TableEntityPropertiesPaged(PageIterator): :keyword str continuation_token: An opaque continuation token. :keyword str location_mode: The location mode being used to list results. The available options include "primary" and "secondary". - :keyword callable entity_hook: A custom entity type for deserialization entities returned + :keyword Callable[Mapping] entity_hook: A custom entity type for deserialization entities returned from the service """ @@ -341,7 +341,7 @@ def __init__(self, command, table, **kwargs): self.filter = kwargs.get("filter") self.select = kwargs.get("select") self.location_mode = None - self.entity_hook = kwargs.pop("entity_hook", _convert_to_entity) + self.entity_hook = kwargs.pop("entity_hook", None) or _convert_to_entity def _get_next_cb(self, continuation_token, **kwargs): next_partition_key, next_row_key = _extract_continuation_token( @@ -366,7 +366,7 @@ def _extract_data_cb(self, get_next_return): self.location_mode, self._response, self._headers = get_next_return props_list = [ self.entity_hook(t) for t in self._response.value - ] # self._get_props_list() + ] next_entity = {} if self._headers[NEXT_PARTITION_KEY] or self._headers[NEXT_ROW_KEY]: next_entity = { 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 acc92c9f86cf..3782aca34264 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 @@ -427,7 +427,7 @@ def list_entities( :keyword int results_per_page: Number of entities per page in returned ItemPaged :keyword select: Specify desired properties of an entity to return certain entities - :keywork entity_hook: Callable for custom deserialization + :keyword Callable[Mapping] entity_hook: for custom deserialization :paramtype select: str or list[str] :return: Query of table entities :rtype: ~azure.core.paging.ItemPaged[~azure.data.tables.TableEntity] @@ -443,11 +443,6 @@ def list_entities( :caption: List all entities held within a table """ entity_hook = kwargs.pop("entity_hook", None) - page_iterator_class = TableEntityPropertiesPaged - if entity_hook: - page_iterator_class = functools.partial( - TableEntityPropertiesPaged, entity_hook=entity_hook - ) user_select = kwargs.pop("select", None) if user_select and not isinstance(user_select, str): @@ -460,7 +455,9 @@ def list_entities( table=self.table_name, results_per_page=top, select=user_select, - page_iterator_class=page_iterator_class, + page_iterator_class=functools.partial( + TableEntityPropertiesPaged, entity_hook=entity_hook + ), ) @distributed_trace @@ -475,7 +472,7 @@ def query_entities( :param str filter: Specify a filter to return certain entities :keyword int results_per_page: Number of entities per page in return ItemPaged :keyword select: Specify desired properties of an entity to return certain entities - :keywork entity_hook: Callable for custom deserialization + :keyword Callable[Mapping] entity_hook: for custom deserialization :paramtype select: str or list[str] :keyword dict parameters: Dictionary for formatting query with additional, user defined parameters :return: Query of table entities @@ -492,11 +489,6 @@ def query_entities( :caption: Query entities held within a table """ entity_hook = kwargs.pop("entity_hook", None) - page_iterator_class = TableEntityPropertiesPaged - if entity_hook: - page_iterator_class = functools.partial( - TableEntityPropertiesPaged, entity_hook=entity_hook - ) parameters = kwargs.pop("parameters", None) filter = self._parameter_filter_substitution( @@ -514,7 +506,9 @@ def query_entities( results_per_page=top, filter=filter, select=user_select, - page_iterator_class=page_iterator_class, + page_iterator_class=functools.partial( + TableEntityPropertiesPaged, entity_hook=entity_hook + ), ) @distributed_trace diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py index 67238a36077f..1404cb765511 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_models.py @@ -95,7 +95,7 @@ def __init__(self, command, table, **kwargs): self.filter = kwargs.get("filter") self.select = kwargs.get("select") self.location_mode = None - self.entity_hook = kwargs.pop("entity_hook", _convert_to_entity) + self.entity_hook = kwargs.pop("entity_hook", None) or _convert_to_entity async def _get_next_cb(self, continuation_token, **kwargs): next_partition_key, next_row_key = _extract_continuation_token( 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 af9656516c41..f1a99892780a 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 @@ -447,7 +447,7 @@ def list_entities( :keyword int results_per_page: Number of entities per page in return AsyncItemPaged :keyword select: Specify desired properties of an entity to return certain entities - :keywork entity_hook: Callable for custom deserialization + :keywork Callable[Mapping] entity_hook: Callable for custom deserialization :paramtype select: str or list[str] :return: Query of table entities :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.data.tables.TableEntity] @@ -463,12 +463,6 @@ def list_entities( :caption: Querying entities from a TableClient """ entity_hook = kwargs.pop("entity_hook", None) - page_iterator_class = TableEntityPropertiesPaged - if entity_hook: - page_iterator_class = functools.partial( - TableEntityPropertiesPaged, entity_hook=entity_hook - ) - user_select = kwargs.pop("select", None) if user_select and not isinstance(user_select, str): user_select = ", ".join(user_select) @@ -480,7 +474,9 @@ def list_entities( table=self.table_name, results_per_page=top, select=user_select, - page_iterator_class=page_iterator_class, + page_iterator_class=functools.partial( + TableEntityPropertiesPaged, entity_hook=entity_hook + ), ) @distributed_trace @@ -495,7 +491,7 @@ def query_entities( :param str filter: Specify a filter to return certain entities :keyword int results_per_page: Number of entities per page in return AsyncItemPaged :keyword select: Specify desired properties of an entity to return certain entities - :keywork entity_hook: Callable for custom deserialization + :keywork Callable[Mapping] entity_hook: Callable for custom deserialization :paramtype select: str or list[str] :keyword dict parameters: Dictionary for formatting query with additional, user defined parameters :return: Query of table entities @@ -512,12 +508,6 @@ def query_entities( :caption: Querying entities from a TableClient """ entity_hook = kwargs.pop("entity_hook", None) - page_iterator_class = TableEntityPropertiesPaged - if entity_hook: - page_iterator_class = functools.partial( - TableEntityPropertiesPaged, entity_hook=entity_hook - ) - parameters = kwargs.pop("parameters", None) filter = self._parameter_filter_substitution( parameters, filter @@ -534,7 +524,9 @@ def query_entities( results_per_page=top, filter=filter, select=user_select, - page_iterator_class=page_iterator_class, + page_iterator_class=functools.partial( + TableEntityPropertiesPaged, entity_hook=entity_hook + ), ) @distributed_trace_async @@ -552,7 +544,7 @@ async def get_entity( :param row_key: The row key of the entity. :type row_key: str :return: Dictionary mapping operation metadata returned from the service - :keywork entity_hook: Callable for custom deserialization + :keywork Callable[Mapping] entity_hook: Callable for custom deserialization :rtype: ~azure.data.tables.TableEntity :raises ~azure.core.exceptions.HttpResponseError: diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_edmtype.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_edmtype.yaml new file mode 100644 index 000000000000..af23d338f0e4 --- /dev/null +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_edmtype.yaml @@ -0,0 +1,90 @@ +interactions: +- request: + body: '{"TableName": "uttableb36a12f2"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '32' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 11 Feb 2021 18:21:30 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 11 Feb 2021 18:21:30 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/Tables + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#Tables/@Element","TableName":"uttableb36a12f2"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 11 Feb 2021 18:21:30 GMT + location: + - https://fake_table_account.table.core.windows.net/Tables('uttableb36a12f2') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 11 Feb 2021 18:21:31 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 11 Feb 2021 18:21:31 GMT + x-ms-version: + - '2019-02-02' + method: DELETE + uri: https://fake_table_account.table.core.windows.net/Tables('uttableb36a12f2') + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Thu, 11 Feb 2021 18:21:31 GMT + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' + status: + code: 204 + message: No Content +version: 1 diff --git a/sdk/tables/azure-data-tables/tests/test_custom_entity.py b/sdk/tables/azure-data-tables/tests/test_custom_entity.py index 897545908579..9df1d573317d 100644 --- a/sdk/tables/azure-data-tables/tests/test_custom_entity.py +++ b/sdk/tables/azure-data-tables/tests/test_custom_entity.py @@ -13,6 +13,7 @@ TableServiceClient, TableClient, EdmType, + EntityProperty ) from azure.core.exceptions import ResourceExistsError @@ -186,6 +187,42 @@ def test_custom_entity( tables_storage_account_name, tables_primary_storage_account_key ) + # @pytest.mark.xfail + @TablesPreparer() + def test_custom_entity_edmtype( + self, tables_storage_account_name, tables_primary_storage_account_key + ): + table_client = self._set_up( + tables_storage_account_name, tables_primary_storage_account_key + ) + + entity = { + u"PartitionKey": u"pk", + u"RowKey": u"rk", + u"Birthday": EntityProperty( + type=EdmType.DATETIME, + value=u"2020-01-01T12:59:59.0123456Z" + ) + } + try: + with table_client as tc: + tc.create_entity(entity) + entity = tc.get_entity( + partition_key=entity[u"PartitionKey"], + row_key=entity[u"RowKey"], + entity_hook=MyEntity, + ) + + assert isinstance(entity.properties["Birthday"], datetime) + assert "milliseconds" in entity.keys() + assert entity.properties["milliseconds"] == 0.0123456 + assert entity.properties["Birthday"] == datetime(2020, 1, 1, 12, 59, 59) + + finally: + self._tear_down( + tables_storage_account_name, tables_primary_storage_account_key + ) + @TablesPreparer() def test_custom_entity_list( self, tables_storage_account_name, tables_primary_storage_account_key From 55ba44ccf494069b02569317e68a944c784b31cc Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Thu, 11 Feb 2021 13:31:34 -0500 Subject: [PATCH 6/7] should have skipped --- sdk/tables/azure-data-tables/tests/test_custom_entity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/tables/azure-data-tables/tests/test_custom_entity.py b/sdk/tables/azure-data-tables/tests/test_custom_entity.py index 9df1d573317d..e6d6be701abc 100644 --- a/sdk/tables/azure-data-tables/tests/test_custom_entity.py +++ b/sdk/tables/azure-data-tables/tests/test_custom_entity.py @@ -187,7 +187,7 @@ def test_custom_entity( tables_storage_account_name, tables_primary_storage_account_key ) - # @pytest.mark.xfail + @pytest.mark.skip("Fails on entity property.") @TablesPreparer() def test_custom_entity_edmtype( self, tables_storage_account_name, tables_primary_storage_account_key From 43ca14885721683116f73c7f0271a96150b655ee Mon Sep 17 00:00:00 2001 From: seankane-msft Date: Thu, 11 Feb 2021 14:01:20 -0500 Subject: [PATCH 7/7] fixing serialization on specific date scenarios --- .../azure/data/tables/_serialize.py | 8 +- ...tom_entity.test_custom_entity_edmtype.yaml | 108 +++++++++++++++++- .../tests/test_custom_entity.py | 1 - 3 files changed, 109 insertions(+), 8 deletions(-) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_serialize.py b/sdk/tables/azure-data-tables/azure/data/tables/_serialize.py index b4f2e3e3ec79..c7b723c770c9 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_serialize.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_serialize.py @@ -8,6 +8,7 @@ from datetime import datetime from math import isnan from enum import Enum +import six import sys import uuid import isodate @@ -112,7 +113,12 @@ def _to_entity_bool(value): def _to_entity_datetime(value): - return EdmType.DATETIME, _to_utc_datetime(value) + try: + return EdmType.DATETIME, _to_utc_datetime(value) + except AttributeError: + if not isinstance(value, six.string_types): + raise + return EdmType.DATETIME, value def _to_entity_float(value): diff --git a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_edmtype.yaml b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_edmtype.yaml index af23d338f0e4..d4dea893fbd5 100644 --- a/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_edmtype.yaml +++ b/sdk/tables/azure-data-tables/tests/recordings/test_custom_entity.test_custom_entity_edmtype.yaml @@ -15,11 +15,11 @@ interactions: DataServiceVersion: - '3.0' Date: - - Thu, 11 Feb 2021 18:21:30 GMT + - Thu, 11 Feb 2021 18:59:39 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Thu, 11 Feb 2021 18:21:30 GMT + - Thu, 11 Feb 2021 18:59:39 GMT x-ms-version: - '2019-02-02' method: POST @@ -33,7 +33,7 @@ interactions: content-type: - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 date: - - Thu, 11 Feb 2021 18:21:30 GMT + - Thu, 11 Feb 2021 18:59:38 GMT location: - https://fake_table_account.table.core.windows.net/Tables('uttableb36a12f2') server: @@ -47,6 +47,102 @@ interactions: status: code: 201 message: Created +- request: + body: '{"PartitionKey": "pk", "PartitionKey@odata.type": "Edm.String", "RowKey": + "rk", "RowKey@odata.type": "Edm.String", "Birthday": "2020-01-01T12:59:59.0123456Z", + "Birthday@odata.type": "Edm.DateTime"}' + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '197' + Content-Type: + - application/json;odata=nometadata + DataServiceVersion: + - '3.0' + Date: + - Thu, 11 Feb 2021 18:59:39 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 11 Feb 2021 18:59:39 GMT + x-ms-version: + - '2019-02-02' + method: POST + uri: https://fake_table_account.table.core.windows.net/uttableb36a12f2 + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttableb36a12f2/@Element","odata.etag":"W/\"datetime''2021-02-11T18%3A59%3A39.8692984Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-02-11T18:59:39.8692984Z","Birthday@odata.type":"Edm.DateTime","Birthday":"2020-01-01T12:59:59.0123456Z"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 11 Feb 2021 18:59:38 GMT + etag: + - W/"datetime'2021-02-11T18%3A59%3A39.8692984Z'" + location: + - https://fake_table_account.table.core.windows.net/uttableb36a12f2(PartitionKey='pk',RowKey='rk') + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + DataServiceVersion: + - '3.0' + Date: + - Thu, 11 Feb 2021 18:59:39 GMT + User-Agent: + - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) + x-ms-date: + - Thu, 11 Feb 2021 18:59:39 GMT + x-ms-version: + - '2019-02-02' + method: GET + uri: https://fake_table_account.table.core.windows.net/uttableb36a12f2(PartitionKey='pk',RowKey='rk') + response: + body: + string: '{"odata.metadata":"https://fake_table_account.table.core.windows.net/$metadata#uttableb36a12f2/@Element","odata.etag":"W/\"datetime''2021-02-11T18%3A59%3A39.8692984Z''\"","PartitionKey":"pk","RowKey":"rk","Timestamp":"2021-02-11T18:59:39.8692984Z","Birthday@odata.type":"Edm.DateTime","Birthday":"2020-01-01T12:59:59.0123456Z"}' + headers: + cache-control: + - no-cache + content-type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + date: + - Thu, 11 Feb 2021 18:59:39 GMT + etag: + - W/"datetime'2021-02-11T18%3A59%3A39.8692984Z'" + server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-ms-version: + - '2019-02-02' + status: + code: 200 + message: OK - request: body: null headers: @@ -59,11 +155,11 @@ interactions: Content-Length: - '0' Date: - - Thu, 11 Feb 2021 18:21:31 GMT + - Thu, 11 Feb 2021 18:59:39 GMT User-Agent: - azsdk-python-data-tables/12.0.0b5 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0) x-ms-date: - - Thu, 11 Feb 2021 18:21:31 GMT + - Thu, 11 Feb 2021 18:59:39 GMT x-ms-version: - '2019-02-02' method: DELETE @@ -77,7 +173,7 @@ interactions: content-length: - '0' date: - - Thu, 11 Feb 2021 18:21:31 GMT + - Thu, 11 Feb 2021 18:59:39 GMT server: - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 x-content-type-options: diff --git a/sdk/tables/azure-data-tables/tests/test_custom_entity.py b/sdk/tables/azure-data-tables/tests/test_custom_entity.py index e6d6be701abc..1e4dd3f28bfe 100644 --- a/sdk/tables/azure-data-tables/tests/test_custom_entity.py +++ b/sdk/tables/azure-data-tables/tests/test_custom_entity.py @@ -187,7 +187,6 @@ def test_custom_entity( tables_storage_account_name, tables_primary_storage_account_key ) - @pytest.mark.skip("Fails on entity property.") @TablesPreparer() def test_custom_entity_edmtype( self, tables_storage_account_name, tables_primary_storage_account_key