graviti.manager.dataset#

The implementation of the Dataset and DatasetManager.

Module Contents#

Classes#

Dataset

This class defines the basic concept of the dataset on Graviti.

DatasetManager

This class defines the operations on the dataset on Graviti.

class graviti.manager.dataset.Dataset(access_key, url, dataset_id, name, *, alias, default_branch, commit_id, created_at, updated_at, owner, is_public, config)[source]#

Bases: graviti.utility.UserMutableMapping[str, graviti.dataframe.DataFrame], tensorbay.utility.AttrsMixin, 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.

  • dataset_id (str) – Dataset ID.

  • name (str) – The name of the dataset, unique for a user.

  • alias (str) – Dataset alias.

  • default_branch (str) – The default branch of dataset.

  • commit_id (str) – The commit ID.

  • created_at (str) – The time when the dataset was created.

  • updated_at (str) – The time when the dataset was last modified.

  • owner (str) – The owner of the dataset.

  • is_public (bool) – Whether the dataset is public.

  • config (str) – The config of dataset.

classmethod from_pyobj(cls, contents)[source]#

Create a Dataset instance from python dict.

Parameters
  • contents (Dict[str, Any]) –

    A python dict containing all the information of the dataset:

    {
        "access_key": <str>
        "url": <str>
        "id": <str>
        "name": <str>
        "alias": <str>
        "default_branch": <str>
        "commit_id": <str>
        "created_at": <str>
        "updated_at": <str>
        "owner": <str>
        "is_public": <bool>
        "config": <str>
    }
    

  • cls (Type[_T]) –

Returns

A Dataset instance created from the input python dict.

Return type

_T

property HEAD(self)[source]#

Return the current branch or commit.

Returns

The current branch or commit.

Return type

graviti.manager.commit.Commit

property branches(self)[source]#

Get class BranchManager instance.

Returns

Required BranchManager instance.

Return type

graviti.manager.branch.BranchManager

property drafts(self)[source]#

Get class DraftManager instance.

Returns

Required DraftManager instance.

Return type

graviti.manager.draft.DraftManager

property commits(self)[source]#

Get class CommitManager instance.

Returns

Required CommitManager instance.

Return type

graviti.manager.commit.CommitManager

property tags(self)[source]#

Get class TagManager instance.

Returns

Required TagManager instance.

Return type

graviti.manager.tag.TagManager

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

search(self, sheet, criteria)[source]#

Create a search.

Parameters
  • sheet (str) – The sheet name.

  • criteria (Dict[str, Any]) – The criteria of search.

Returns

The created DataFrame instance.

Return type

graviti.dataframe.DataFrame

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) –

create(self, name, alias='', config=None)[source]#

Create a Graviti dataset with given name.

Parameters
  • name (str) – The name of the dataset, unique for a user.

  • alias (str) – Alias of the dataset, default is “”.

  • config (Optional[str]) – The auth storage config name.

Returns

The created Dataset instance.

Return type

Dataset

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

ResourceNotExistError – When the required dataset does not exist.

Return type

Dataset

list(self)[source]#

List Graviti datasets.

Returns

The LazyPagingList of Dataset instances.

Return type

graviti.manager.lazy.LazyPagingList[Dataset]

delete(self, name)[source]#

Delete a Graviti dataset with given name.

Parameters

name (str) – The name of the dataset, unique for a user.

Return type

None