graviti.manager.dataset
#
The implementation of the Dataset and DatasetManager.
Module Contents#
Classes#
RevisionType is an enumeration type including "BRANCH", "COMMIT" and "TAG". |
|
ObjectPermissionManagerType is an enumeration type including "OSS", "S3" and "AZURE". |
|
This class defines the basic concept of the dataset on Graviti. |
|
This class defines the operations on the dataset on Graviti. |
Attributes#
- class graviti.manager.dataset.RevisionType[source]#
Bases:
enum.Enum
RevisionType is an enumeration type including “BRANCH”, “COMMIT” and “TAG”.
- class graviti.manager.dataset.ObjectPermissionManagerType[source]#
Bases:
enum.Enum
ObjectPermissionManagerType is an enumeration type including “OSS”, “S3” and “AZURE”.
- class graviti.manager.dataset.Dataset(access_key, url, response)[source]#
Bases:
graviti.utility.UserMutableMapping
[str
,graviti.dataframe.DataFrame
],graviti.utility.ReprMixin
This class defines the basic concept of the dataset on Graviti.
- Parameters
access_key (str) – User’s access key.
url (str) – The URL of the graviti website.
response (Dict[str, Any]) –
The response of the OpenAPI associated with the dataset:
{ "id": <str> "name": <str> "alias": <str> "default_branch": <str> "commit_id": <Optional[str]> "cover_url": <str> "created_at": <str> "updated_at": <str> "owner": <str> "is_public": <bool> "config": <str> "backend_type": <str> }
- dataset_id#
Dataset ID.
- name#
The name of the dataset, unique for a user.
- alias#
Dataset alias.
- default_branch#
The default branch of dataset.
- commit_id#
The commit ID of the dataset.
- created_at#
The time when the dataset was created.
- updated_at#
The time when the dataset was last modified.
- owner#
The owner of the dataset.
- is_public#
Whether the dataset is public.
- config#
The config of dataset.
- backend_type#
The backend type of dataset storage.
- property HEAD(self)[source]#
Return the current branch or commit.
- Returns
The current branch or commit.
- Return type
- property branches(self)[source]#
Get class
BranchManager
instance.- Returns
Required
BranchManager
instance.- Return type
- property drafts(self)[source]#
Get class
DraftManager
instance.- Returns
Required
DraftManager
instance.- Return type
- property commits(self)[source]#
Get class
CommitManager
instance.- Returns
Required
CommitManager
instance.- Return type
- property tags(self)[source]#
Get class
TagManager
instance.- Returns
Required
TagManager
instance.- Return type
- checkout(self, revision)[source]#
Checkout to a commit.
- Parameters
revision (str) – The information to locate the specific commit, which can be the commit id, the branch, or the tag.
- Return type
None
- edit(self, *, name=None, alias=None, default_branch=None)[source]#
Update the meta data of the dataset.
- Parameters
name (Optional[str]) – The new name of the dataset.
alias (Optional[str]) – The new alias of the dataset.
default_branch (Optional[str]) – The new default branch of the dataset.
- Return type
None
- commit(self, title, description=None, jobs=8, quiet=False)[source]#
Create, upload and commit the draft to push the local dataset to Graviti.
- Parameters
title (str) – The commit title.
description (Optional[str]) – The commit description.
jobs (int) – The number of the max workers in multi-thread upload, the default is 8.
quiet (bool) – Set to True to stop showing the upload process bar.
- Raises
StatusError – When the HEAD of the dataset is not a branch.
StatusError – When the dataset has no modifications.
- Return type
None
- class graviti.manager.dataset.DatasetManager(access_key, url, owner)[source]#
This class defines the operations on the dataset on Graviti.
- Parameters
access_key (str) – User’s access key.
url (str) – The URL of the graviti website.
owner (str) –
- get(self, dataset)[source]#
Get a Graviti dataset with given name.
- Parameters
dataset (str) – The name of the dataset, unique for a user.
- Returns
The requested
Dataset
instance.- Raises
ResourceNameError – When the required dataset does not exist.
- Return type