Dataset

class verta.dataset.entities.Dataset(conn, conf, msg)

Object representing a ModelDB dataset.

Changed in version 0.16.0: The dataset versioning interface was updated for flexibility, robustness, and consistency with other ModelDB entities.

This class provides read/write functionality for dataset metadata and access to its versions.

There should not be a need to instantiate this class directly; please use Client.create_dataset().

Variables:
  • id (str) – ID of this dataset.

  • name (str) – Name of this dataset.

  • url (str) – Verta web app URL.

  • workspace (str) – Workspace containing this dataset.

  • versions (DatasetVersions) – Versions of this dataset.

add_attribute(key, value)

Adds an attribute to this dataset.

Parameters:
  • key (str) – Name of the attribute.

  • value (one of {None, bool, float, int, str, list, dict}) – Value of the attribute.

add_attributes(attrs)

Adds potentially multiple attributes to this dataset.

Parameters:

attributes (dict of str to {None, bool, float, int, str, list, dict}) – Attributes.

add_tag(tag)

Adds a tag to this dataset.

Parameters:

tag (str) – Tag to add.

add_tags(tags)

Adds multiple tags to this dataset.

Parameters:

tags (list of str) – Tags to add.

create_version(content, desc=None, tags=None, attrs=None, date_created=None)

Creates a dataset version.

Parameters:
  • content (dataset content) – Dataset content.

  • desc (str, optional) – Description of the dataset version.

  • tags (list of str, optional) – Tags of the dataset version.

  • attrs (dict of str to {None, bool, float, int, str}, optional) – Attributes of the dataset version.

Returns:

DatasetVersion

Examples

from verta.dataset import Path
version = dataset.create_version(Path("data.csv"))
del_attribute(key)

Deletes the attribute with name key from this dataset.

This method will not raise an error if the attribute does not exist.

Parameters:

key (str) – Name of the attribute.

del_tag(tag)

Deletes a tag from this dataset.

This method will not raise an error if the tag does not exist.

Parameters:

tag (str) – Tag to delete.

delete()

Deletes this dataset.

get_attribute(key)

Gets the attribute with name key from this dataset.

Parameters:

key (str) – Name of the attribute.

Returns:

one of {None, bool, float, int, str} – Value of the attribute.

get_attributes()

Gets all attributes from this dataset.

Returns:

dict of str to {None, bool, float, int, str} – Names and values of all attributes.

get_description()

Gets the description of this dataset.

Returns:

str – Description of this dataset.

get_latest_version()

Gets the latest dataset version.

Returns:

DatasetVersion

get_tags()

Gets all tags from this dataset.

Returns:

list of str – All tags.

get_version(id)

Gets the specified dataset version.

Parameters:

id (str) – Dataset version ID.

Returns:

DatasetVersion

set_description(desc)

Sets the description of this dataset.

Parameters:

desc (str) – Description to set.