graviti.openapi.data
#
Interfaces about the data.
Module Contents#
Functions#
|
Execute the OpenAPI GET /v2/datasets/{workspace}/{dataset}/drafts/{draft_number} /sheets/{sheet}/data. |
|
Execute the OpenAPI GET /v2/datasets/{workspace}/{dataset}/commits/{commit_id}/sheets /{sheet}/data. |
|
Execute the OpenAPI PATCH /v2/datasets/{workspace}/{dataset}/drafts/{draft_number} /sheets/{sheet}/data. |
|
Execute the OpenAPI POST /v2/datasets/{workspace}/{dataset}/drafts/{draft_number} /sheets/{sheet}/data. |
|
Execute the OpenAPI DELETE /v2/datasets/{workspace}/{dataset}/drafts/{draft_number} /sheets/{sheet}/data. |
- graviti.openapi.data.list_draft_data(access_key, url, workspace, dataset, *, draft_number, sheet, columns=None, order_by=None, offset=None, limit=None)[source]#
Execute the OpenAPI GET /v2/datasets/{workspace}/{dataset}/drafts/{draft_number} /sheets/{sheet}/data.
- Parameters
access_key (str) – User’s access key.
url (str) – The URL of the graviti website.
workspace (str) – The workspace of the dataset.
dataset (str) – Name of the dataset, unique for a user.
draft_number (int) – The draft number.
sheet (str) – The sheet name.
columns (Optional[str]) – The string of column names separated by
|
. Multiple indexes can be expressed using.
. None means to get all columns.order_by (Optional[str]) – The string of column names separated by
|
whose order determines the precedence of the sort. The rest are sorted by __record_key first. Multiple indexes can be expressed using.
.offset (Optional[int]) – The offset of the page. The default value of this param in OpenAPIv2 is 0.
limit (Optional[int]) – The limit of the page. The default value of this param in OpenAPIv2 is 128.
- Returns
The response of OpenAPI.
- Return type
Dict[str, Any]
Examples
>>> list_draft_data( ... "ACCESSKEY-********", ... "https://api.graviti.com", ... "graviti-example", ... "MNIST", ... draft_number = 1, ... sheet = "train", ... order_by = "filename|attribute.weather", ... ) { "data": [ { "__record_key": "123750493121329585", "filename": "0000f77c-6257be58.jpg", "image": { "url": "https://content-store-prod-vers", "checksum": "dcc197970e607f7576d978972f6fb312911ce005" }, "attribute": { "weather": "clear", "scene": "city street", "timeofday": "daytime" }, "box2ds": [ { "xmin": 1125.902264, "xmax": 1156.978645, "ymin": 133.184488, "ymax": 210.875445, "category": "traffic light", "attribute": { "occluded": false, "truncated": false, "trafficLightColor": "G" } }, { "xmin": 1156.978645, "xmax": 1191.50796, "ymin": 136.637417, "ymax": 210.875443, "category": "traffic light", "attribute": { "occluded": false, "truncated": false, "trafficLightColor": "G" } }, ... ] }, ...(total 128 items) ], "offset": 0, "record_size": 128, "total_count": 70000 }
- graviti.openapi.data.list_commit_data(access_key, url, workspace, dataset, *, commit_id, sheet, columns=None, order_by=None, offset=None, limit=None)[source]#
Execute the OpenAPI GET /v2/datasets/{workspace}/{dataset}/commits/{commit_id}/sheets /{sheet}/data.
- Parameters
access_key (str) – User’s access key.
url (str) – The URL of the graviti website.
workspace (str) – The workspace of the dataset.
dataset (str) – Name of the dataset, unique for a user.
commit_id (str) – The commit id.
sheet (str) – The sheet name.
columns (Optional[str]) – The string of column names separated by
|
. Multiple indexes can be expressed using.
. None means to get all columns.order_by (Optional[str]) – The string of column names separated by
|
whose order determines the precedence of the sort. The rest are sorted by __record_key first. Multiple indexes can be expressed using.
.offset (Optional[int]) – The offset of the page. The default value of this param in OpenAPIv2 is 0.
limit (Optional[int]) – The limit of the page. The default value of this param in OpenAPIv2 is 128.
- Returns
The response of OpenAPI.
- Return type
Dict[str, Any]
Examples
>>> list_commit_data( ... "ACCESSKEY-********", ... "https://api.graviti.com", ... "graviti-example", ... "MNIST", ... commit_id = "fde63f357daf46088639e9f57fd81cad", ... sheet = "train", ... order_by = "filename|attribute.weather", ... ) { "data": [ { "__record_key": "123750493121329585", "filename": "0000f77c-6257be58.jpg", "image": { "url": "https://content-store-prod-vers", "checksum": "dcc197970e607f7576d978972f6fb312911ce005" }, "attribute": { "weather": "clear", "scene": "city street", "timeofday": "daytime" }, "box2ds": [ { "xmin": 1125.902264, "xmax": 1156.978645, "ymin": 133.184488, "ymax": 210.875445, "category": "traffic light", "attribute": { "occluded": false, "truncated": false, "trafficLightColor": "G" } }, { "xmin": 1156.978645, "xmax": 1191.50796, "ymin": 136.637417, "ymax": 210.875443, "category": "traffic light", "attribute": { "occluded": false, "truncated": false, "trafficLightColor": "G" } }, ... ] }, ...(total 128 items) ], "offset": 0, "record_size": 128, "total_count": 70000 }
- graviti.openapi.data.update_data(access_key, url, workspace, dataset, *, draft_number, sheet, data)[source]#
Execute the OpenAPI PATCH /v2/datasets/{workspace}/{dataset}/drafts/{draft_number} /sheets/{sheet}/data.
- Parameters
access_key (str) – User’s access key.
url (str) – The URL of the graviti website.
workspace (str) – The workspace of the dataset.
dataset (str) – Name of the dataset, unique for a user.
draft_number (int) – The draft number.
sheet (str) – The sheet name.
data (Union[List[Dict[str, Any]], Tuple[Dict[str, Any], Ellipsis]]) – The update data.
- Return type
None
Examples
>>> update_data( ... "ACCESSKEY-********", ... "https://api.graviti.com", ... "graviti-example", ... "OxfordIIITPet", ... draft_number = 1, ... sheet = "train", ... data = [ ... { ... "__record_key": "123750493121329585", ... "filename": "0000f77c-6257be58.jpg", ... "image": { ... "checksum": "dcc197970e607f7576d978972f6fb312911ce005" ... }, ... "attribute": { ... "weather": "clear", ... "scene": "city street", ... "timeofday": "daytime" ... }, ... }, ... { ... "__record_key": "123750493121329585", ... "filename": "0000f77c-62c2a288.jpg", ... "image": { ... "checksum": "dcc197970e607f7576d978972f6fb2a2881ce004" ... }, ... "attribute": { ... "weather": "clear", ... "scene": "highway", ... "timeofday": "dawn/dusk" ... }, ... } ... ], ... )
- graviti.openapi.data.add_data(access_key, url, workspace, dataset, *, draft_number, sheet, data, strategy_arguments=None)[source]#
Execute the OpenAPI POST /v2/datasets/{workspace}/{dataset}/drafts/{draft_number} /sheets/{sheet}/data.
- Parameters
access_key (str) – User’s access key.
url (str) – The URL of the graviti website.
workspace (str) – The workspace of the dataset.
dataset (str) – Name of the dataset, unique for a user.
draft_number (int) – The draft number.
sheet (str) – The sheet name.
data (Union[List[Dict[str, Any]], Tuple[Dict[str, Any], Ellipsis]]) – The update data.
strategy_arguments (Optional[Dict[str, Any]]) – Arguments required by the
__record_key
generation strategy of the sheet.
- Return type
None
Examples
>>> add_data( ... "ACCESSKEY-********", ... "https://api.graviti.com", ... "graviti-example", ... "OxfordIIITPet", ... draft_number = 1, ... sheet = "train", ... data = [ ... { ... "filename": "0000f77c-6257be58.jpg", ... "image": { ... "checksum": "dcc197970e607f7576d978972f6fb312911ce005" ... }, ... "attribute": { ... "weather": "clear", ... "scene": "city street", ... "timeofday": "daytime" ... }, ... }, ... { ... "filename": "0000f77c-62c2a288.jpg", ... "image": { ... "checksum": "dcc197970e607f7576d978972f6fb2a2881ce004" ... }, ... "attribute": { ... "weather": "clear", ... "scene": "highway", ... "timeofday": "dawn/dusk" ... }, ... } ... ], ... )
- graviti.openapi.data.delete_data(access_key, url, workspace, dataset, *, draft_number, sheet, record_keys)[source]#
Execute the OpenAPI DELETE /v2/datasets/{workspace}/{dataset}/drafts/{draft_number} /sheets/{sheet}/data.
- Parameters
access_key (str) – User’s access key.
url (str) – The URL of the graviti website.
workspace (str) – The workspace of the dataset.
dataset (str) – Name of the dataset, unique for a user.
draft_number (int) – The draft number.
sheet (str) – The sheet name.
record_keys (List[str]) – The record keys of the data to be deleted.
- Return type
None
Examples
>>> delete_data( ... "ACCESSKEY-********", ... "https://api.graviti.com", ... "graviti-example", ... "OxfordIIITPet", ... draft_number = 1, ... sheet = "train", ... record_keys = ["123750493121329585", "123750493121329586"], ... )