graviti.openapi.dataset
#
Interfaces about the dataset.
Module Contents#
Functions#
|
Execute the OpenAPI POST /v2/datasets. |
|
Execute the OpenAPI GET /v2/datasets/{workspace}/{dataset}. |
|
Execute the OpenAPI GET /v2/datasets. |
|
Execute the OpenAPI PATCH /v2/datasets/{workspace}/{dataset}. |
|
Execute the OpenAPI DELETE /v2/datasets/{workspace}/{dataset}. |
- graviti.openapi.dataset.create_dataset(access_key, url, name, *, alias='', storage_config=None, with_draft=None)[source]#
Execute the OpenAPI POST /v2/datasets.
- Parameters
access_key (str) – User’s access key.
url (str) – The URL of the graviti website.
name (str) – Name of the dataset, unique for a user.
alias (str) – Alias of the dataset, default is “”.
storage_config (Optional[str]) – The auth storage config name.
with_draft (Optional[bool]) – Whether to create a draft after the dataset is created. The default value of this parameter in OpenAPIv2 is False.
- Returns
The response of OpenAPI.
- Return type
Dict[str, Any]
Examples
>>> create_dataset( ... "ACCESSKEY-********", ... "https://api.graviti.com", ... "MNIST", ... ) { "id": "2bc95d506db2401b898067f1045d7f68", "name": "OxfordIIITPet", "alias": "", "workspace": "graviti-example", "default_branch": "main", "commit_id": None, "cover_url": "https://tutu.s3.cn-northwest-1.amazonaws.com.cn/", "creator": "czhual", "created_at": "2021-03-03T18:58:10Z", "updated_at": "2021-03-03T18:58:10Z", "is_public": false, "storage_config": "exampleConfigName", "backend_type": "OSS" }
- graviti.openapi.dataset.get_dataset(access_key, url, workspace, dataset)[source]#
Execute the OpenAPI GET /v2/datasets/{workspace}/{dataset}.
- 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.
- Returns
The response of OpenAPI.
- Return type
Dict[str, Any]
Examples
>>> get_dataset( ... "ACCESSKEY-********", ... "https://api.graviti.com", ... "graviti-example", ... "OxfordIIITPet" ... ) { "id": "2bc95d506db2401b898067f1045d7f68", "name": "OxfordIIITPet", "alias": "Oxford-IIIT Pet", "workspace": "graviti-example", "default_branch": "main", "commit_id": "a0d4065872f245e4ad1d0d1186e3d397", "cover_url": "https://tutu.s3.cn-northwest-1.amazonaws.com.cn/", "creator": "czhual", "created_at": "2021-03-03T18:58:10Z", "updated_at": "2021-03-03T18:58:10Z", "is_public": false, "storage_config": "exampleConfigName", "backend_type": "OSS" }
- graviti.openapi.dataset.list_datasets(access_key, url, *, offset=None, limit=None)[source]#
Execute the OpenAPI GET /v2/datasets.
- Parameters
access_key (str) – User’s access key.
url (str) – The URL of the graviti website.
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_datasets("ACCESSKEY-********", "https://api.graviti.com") { "datasets": [ { "id": "2bc95d506db2401b898067f1045d7f68", "name": "OxfordIIITPet", "alias": "Oxford-IIIT Pet", "workspace": "graviti-example", "default_branch": "main", "commit_id": "a0d4065872f245e4ad1d0d1186e3d397", "cover_url": "https://tutu.s3.cn-northwest-1.amazonaws.com.cn/", "created_at": "2021-03-03T18:58:10Z", "updated_at": "2021-03-03T18:58:10Z", "creator": "czhual", "is_public": false, "storage_config": "exampleConfigName", "backend_type": "OSS" } ], "offset": 0, "record_size": 1, "total_count": 1 }
- graviti.openapi.dataset.update_dataset(access_key, url, workspace, dataset, *, name=None, alias=None, default_branch=None)[source]#
Execute the OpenAPI PATCH /v2/datasets/{workspace}/{dataset}.
- 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.
name (Optional[str]) – New name of the dataset, unique for a user.
alias (Optional[str]) – New alias of the dataset.
default_branch (Optional[str]) – User’s chosen branch.
- Returns
The response of OpenAPI.
- Return type
Dict[str, Any]
Examples
>>> update_dataset( ... "ACCESSKEY-********", ... "https://api.graviti.com", ... "graviti-example", ... "OxfordIIITPet", ... name="OxfordIIITPets", ... alias="Oxford-IIIT Pet", ... default_branch="main", ... ) { "id": "2bc95d506db2401b898067f1045d7f68", "name": "OxfordIIITPet", "alias": "Oxford-IIIT Pet", "workspace": "graviti-example", "default_branch": "main", "commit_id": "a0d4065872f245e4ad1d0d1186e3d397", "cover_url": "https://tutu.s3.cn-northwest-1.amazonaws.com.cn/", "created_at": "2021-03-03T18:58:10Z", "updated_at": "2021-03-03T18:58:10Z", "creator": "czhual", "is_public": false, "storage_config": "exampleConfigName", "backend_type": "OSS" }
- graviti.openapi.dataset.delete_dataset(access_key, url, workspace, dataset)[source]#
Execute the OpenAPI DELETE /v2/datasets/{workspace}/{dataset}.
- 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.
- Return type
None
Examples
>>> delete_dataset( ... "ACCESSKEY-********", ... "https://api.graviti.com", ... "graviti-example", ... "OxfordIIITPet", ... )