Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tableitem metadata #13445

Merged
merged 10 commits into from
Sep 2, 2020
17 changes: 13 additions & 4 deletions sdk/tables/azure-data-tables/azure/data/tables/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,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 = []
props_list = [TableItem(t) for t in self._response.value]
props_list = [TableItem(t, self._headers) for t in self._response.value]
return self._headers['x-ms-continuation-NextTableName'] or None, props_list


Expand Down Expand Up @@ -460,13 +459,23 @@ def service_properties_deserialize(generated):

class TableItem(object):
"""
Represents an Azure TableItem. Returned by list_tables and query_tables.
Represents an Azure TableItem. Returned by TableServiceClient.list_tables
and TableServiceClient.query_tables.

:ivar str name: The name of the table.
:ivar str api_version: The API version included in the service call
:ivar str date: The date the service call was made
"""

def __init__(self, table):
def __init__(
self,
table, # type: str
headers=None # type: dict[str,str]
):
# type: (...) -> None
self.table_name = table
self.api_version = headers.pop('version', None)
self.date = headers.pop('date', None) or headers.pop('Date', None)


class TablePayloadFormat(object):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from ._serialize import serialize_iso
from ._deserialize import _return_headers_and_deserialized
from ._error import _process_table_error
from ._models import TableEntityPropertiesPaged, UpdateMode, TableItem
from ._models import TableEntityPropertiesPaged, UpdateMode


class TableClient(TableClientBase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,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(t) for t in self._response.value]
props_list = [TableItem(t, self._headers) for t in self._response.value]
return self._headers['x-ms-continuation-NextTableName'] or None, props_list


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ interactions:
DataServiceVersion:
- '3.0'
Date:
- Wed, 19 Aug 2020 21:17:59 GMT
- Mon, 31 Aug 2020 18:17:53 GMT
User-Agent:
- azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0)
- azsdk-python-data-tables/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Wed, 19 Aug 2020 21:17:59 GMT
- Mon, 31 Aug 2020 18:17:53 GMT
x-ms-version:
- '2019-07-07'
method: POST
Expand All @@ -33,7 +33,7 @@ interactions:
content-type:
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
date:
- Wed, 19 Aug 2020 21:17:59 GMT
- Mon, 31 Aug 2020 18:17:50 GMT
location:
- https://storagename.table.core.windows.net/Tables('pytablesynca4ed0b50')
server:
Expand All @@ -59,11 +59,11 @@ interactions:
Content-Length:
- '0'
Date:
- Wed, 19 Aug 2020 21:18:00 GMT
- Mon, 31 Aug 2020 18:17:53 GMT
User-Agent:
- azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0)
- azsdk-python-data-tables/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Wed, 19 Aug 2020 21:18:00 GMT
- Mon, 31 Aug 2020 18:17:53 GMT
x-ms-version:
- '2019-07-07'
method: DELETE
Expand All @@ -77,7 +77,7 @@ interactions:
content-length:
- '0'
date:
- Wed, 19 Aug 2020 21:17:59 GMT
- Mon, 31 Aug 2020 18:17:51 GMT
server:
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
x-content-type-options:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ interactions:
DataServiceVersion:
- '3.0'
Date:
- Thu, 27 Aug 2020 21:28:19 GMT
- Tue, 01 Sep 2020 19:13:20 GMT
User-Agent:
- azsdk-python-data-tables/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0)
- azsdk-python-data-tables/12.0.0b1 Python/3.8.4 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Thu, 27 Aug 2020 21:28:19 GMT
- Tue, 01 Sep 2020 19:13:20 GMT
x-ms-version:
- '2019-07-07'
- '2019-02-02'
method: POST
uri: https://storagename.table.core.windows.net/Tables
response:
Expand All @@ -33,7 +33,7 @@ interactions:
content-type:
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
date:
- Thu, 27 Aug 2020 21:28:20 GMT
- Tue, 01 Sep 2020 19:13:20 GMT
location:
- https://storagename.table.core.windows.net/Tables('pytablesync6d7c1113')
server:
Expand All @@ -43,7 +43,7 @@ interactions:
x-content-type-options:
- nosniff
x-ms-version:
- '2019-07-07'
- '2019-02-02'
status:
code: 201
message: Created
Expand All @@ -63,37 +63,79 @@ interactions:
DataServiceVersion:
- '3.0'
Date:
- Thu, 27 Aug 2020 21:28:20 GMT
- Tue, 01 Sep 2020 19:13:20 GMT
User-Agent:
- azsdk-python-data-tables/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0)
- azsdk-python-data-tables/12.0.0b1 Python/3.8.4 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Thu, 27 Aug 2020 21:28:20 GMT
- Tue, 01 Sep 2020 19:13:20 GMT
x-ms-version:
- '2019-07-07'
- '2019-02-02'
method: POST
uri: https://storagename.table.core.windows.net/Tables
response:
body:
string: '{"odata.error":{"code":"TableAlreadyExists","message":{"lang":"en-US","value":"The
table specified already exists.\nRequestId:2e7b208e-d002-003b-7bb8-7c685f000000\nTime:2020-08-27T21:28:21.0100931Z"}}}'
table specified already exists.\nRequestId:f3b2a809-a002-0062-6d93-804425000000\nTime:2020-09-01T19:13:20.4896908Z"}}}'
headers:
cache-control:
- no-cache
content-type:
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
date:
- Thu, 27 Aug 2020 21:28:20 GMT
- Tue, 01 Sep 2020 19:13:20 GMT
server:
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
transfer-encoding:
- chunked
x-content-type-options:
- nosniff
x-ms-version:
- '2019-07-07'
- '2019-02-02'
status:
code: 409
message: Conflict
- request:
body: null
headers:
Accept:
- application/json;odata=minimalmetadata
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
DataServiceVersion:
- '3.0'
Date:
- Tue, 01 Sep 2020 19:13:20 GMT
User-Agent:
- azsdk-python-data-tables/12.0.0b1 Python/3.8.4 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Tue, 01 Sep 2020 19:13:20 GMT
x-ms-version:
- '2019-02-02'
method: GET
uri: https://storagename.table.core.windows.net/Tables?$filter=TableName%20eq%20%27pytablesync6d7c1113%27
response:
body:
string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[{"TableName":"pytablesync6d7c1113"}]}'
headers:
cache-control:
- no-cache
content-type:
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
date:
- Tue, 01 Sep 2020 19:13:20 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:
Expand All @@ -106,13 +148,13 @@ interactions:
Content-Length:
- '0'
Date:
- Thu, 27 Aug 2020 21:28:20 GMT
- Tue, 01 Sep 2020 19:13:20 GMT
User-Agent:
- azsdk-python-data-tables/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0)
- azsdk-python-data-tables/12.0.0b1 Python/3.8.4 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Thu, 27 Aug 2020 21:28:20 GMT
- Tue, 01 Sep 2020 19:13:20 GMT
x-ms-version:
- '2019-07-07'
- '2019-02-02'
method: DELETE
uri: https://storagename.table.core.windows.net/Tables('pytablesync6d7c1113')
response:
Expand All @@ -124,13 +166,13 @@ interactions:
content-length:
- '0'
date:
- Thu, 27 Aug 2020 21:28:20 GMT
- Tue, 01 Sep 2020 19:13:20 GMT
server:
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
x-content-type-options:
- nosniff
x-ms-version:
- '2019-07-07'
- '2019-02-02'
status:
code: 204
message: No Content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ interactions:
DataServiceVersion:
- '3.0'
Date:
- Wed, 19 Aug 2020 21:18:00 GMT
- Fri, 28 Aug 2020 15:20:06 GMT
User-Agent:
- azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0)
- azsdk-python-data-tables/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Wed, 19 Aug 2020 21:18:00 GMT
- Fri, 28 Aug 2020 15:20:06 GMT
x-ms-version:
- '2019-07-07'
method: POST
Expand All @@ -33,7 +33,7 @@ interactions:
content-type:
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
date:
- Wed, 19 Aug 2020 21:18:01 GMT
- Fri, 28 Aug 2020 15:20:07 GMT
location:
- https://storagename.table.core.windows.net/Tables('pytablesyncded1139b')
server:
Expand All @@ -59,11 +59,11 @@ interactions:
Content-Length:
- '0'
Date:
- Wed, 19 Aug 2020 21:18:01 GMT
- Fri, 28 Aug 2020 15:20:07 GMT
User-Agent:
- azsdk-python-storage-table/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0)
- azsdk-python-data-tables/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Wed, 19 Aug 2020 21:18:01 GMT
- Fri, 28 Aug 2020 15:20:07 GMT
x-ms-version:
- '2019-07-07'
method: DELETE
Expand All @@ -77,7 +77,7 @@ interactions:
content-length:
- '0'
date:
- Wed, 19 Aug 2020 21:18:01 GMT
- Fri, 28 Aug 2020 15:20:07 GMT
server:
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
x-content-type-options:
Expand All @@ -87,4 +87,46 @@ interactions:
status:
code: 204
message: No Content
- request:
body: null
headers:
Accept:
- application/json;odata=minimalmetadata
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
DataServiceVersion:
- '3.0'
Date:
- Fri, 28 Aug 2020 15:20:07 GMT
User-Agent:
- azsdk-python-data-tables/2019-07-07 Python/3.8.4 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Fri, 28 Aug 2020 15:20:07 GMT
x-ms-version:
- '2019-07-07'
method: GET
uri: https://storagename.table.core.windows.net/Tables?$filter=TableName%20eq%20%27pytablesyncded1139b%27
response:
body:
string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#Tables","value":[]}'
headers:
cache-control:
- no-cache
content-type:
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
date:
- Fri, 28 Aug 2020 15:20:08 GMT
server:
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
transfer-encoding:
- chunked
x-content-type-options:
- nosniff
x-ms-version:
- '2019-07-07'
status:
code: 200
message: OK
version: 1
Loading