You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Metadata class should be modified to assist on the creation of the metadata dictionary.
First, the metadata argument from the Metadata.__init__ method should be made optional (default to None).
Then, the following methods should be added:
add_table(name, primary_key=None, fields=None, data=None, parent=None, foreign_key=None): a New table to the dataset.
all the arguments are optional.
If fields are given they can either be a list or dict. If they are a dict, they are validated and directly used.
If the data is given and fields are not, or they are given as a list, fields is built from the dataframe dtypes. If fields is a list, only those fields are used. Data can either be DataFrame or a path to a CSV file. If the path is relative, it must be relative to the Metadata root_path.
if a parent is given, a relationship is created using the foreign key of this table and the primary key of the parent. The parent must exist beforehand in the metadata.
Additional arguments such as anonymization details or regular expressions must set either inside the fields argument or afterwards.
remove_table(table): remove the table from metadata. If child tables exist, relationships must be removed first.
add_relationship(table, parent, foreign_key): Add an individual relationship between two tables. foreign_key field details are inherited from the parent table and validated against the table data.
remove_relationship(table, parent): Remove the relationship between two tables.
add_field(table, field, field_details): add a new field to the table. If the field already exists, an exception suggesting to use update_field is raised.
update_field(table, field, field_deatils): replace the field specification with the given values.
remove_field(table, field): remove a field from the table.
to_dict(): Return the complete metadata specification as a dictionary.
to_json(): Store the dict specification of the metadata in the given location. Use indent=4.
The text was updated successfully, but these errors were encountered:
The
Metadata
class should be modified to assist on the creation of the metadata dictionary.First, the
metadata
argument from theMetadata.__init__
method should be made optional (default to None).Then, the following methods should be added:
add_table(name, primary_key=None, fields=None, data=None, parent=None, foreign_key=None)
: a New table to the dataset.remove_table(table)
: remove the table from metadata. If child tables exist, relationships must be removed first.add_relationship(table, parent, foreign_key)
: Add an individual relationship between two tables. foreign_key field details are inherited from the parent table and validated against the table data.remove_relationship(table, parent)
: Remove the relationship between two tables.add_field(table, field, field_details)
: add a new field to the table. If the field already exists, an exception suggesting to useupdate_field
is raised.update_field(table, field, field_deatils)
: replace the field specification with the given values.remove_field(table, field)
: remove a field from the table.to_dict()
: Return the complete metadata specification as a dictionary.to_json()
: Store the dict specification of the metadata in the given location. Useindent=4
.The text was updated successfully, but these errors were encountered: