Danger

You are looking at the documentation for an older version of the SDV! We are no longer supporting or maintaining this version of the software

Click here to go to the new docs pages.

sdv.metadata.dataset.Metadata

class sdv.metadata.dataset.Metadata(metadata=None, root_path=None)[source]

Dataset Metadata.

The Metadata class provides a unified layer of abstraction over the dataset metadata, which includes both the necessary details to load the data from the hdd and to know how to parse and transform it to numerical data.

Parameters
  • metadata (str or dict) – Path to a json file that contains the metadata or a dict representation of metadata following the same structure.

  • root_path (str) – The path to which the paths found inside the metadata are relative. If not given, it defaults to the folder where the metadata is located, or to None, if no metadata is given.

__init__(metadata=None, root_path=None)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__([metadata, root_path])

Initialize self.

add_field(table, field, field_type[, …])

Add a new field to the indicated table.

add_relationship(parent, child[, …])

Add a new relationship between the parent and child tables.

add_table(name[, data, fields, …])

Add a new table to this metadata.

get_children(table_name)

Get tables for which the given table is parent.

get_dtypes(table_name[, ids, errors])

Get a dict with the dtypes for each field of a given table.

get_field_meta(table_name, field_name)

Get the metadata dict for a table.

get_fields(table_name)

Get the metadata of the fields of the indicated table.

get_foreign_keys(parent, child)

Get the name of all the fields in the child that are foreign keys to this parent.

get_parents(table_name)

Get tables for with the given table is child.

get_primary_key(table_name)

Get the name of the primary key of the indicated table, if it has one.

get_table_meta(table_name)

Get the metadata dict for a table.

get_tables()

Get the list with the tables found in this metadata.

load_table(table_name)

Load the data of the indicated table as a DataFrame.

load_tables([tables])

Get a dictionary with data from multiple tables.

set_primary_key(table, field)

Set the primary key field of the indicated table.

to_dict()

Get a dict representation of this metadata.

to_json(path)

Dump this metadata into a JSON file.

validate([tables])

Validate this metadata.

visualize([path, names, details])

Plot metadata usign graphviz.

Attributes

root_path