deriva.utils.catalog.manage package

Submodules

deriva.utils.catalog.manage.config module

deriva.utils.catalog.manage.deriva_csv module

deriva.utils.catalog.manage.dump_catalog module

class deriva.utils.catalog.manage.dump_catalog.DerivaCatalogToString(model, provide_system_columns=True, groups=None)[source]

Bases: object

annotations_to_str(annotations, var_name='annotations')[source]

Print out the annotation definition in annotations, substituting the python variable for each of the tags specified in tag_map. :param annotations: :param var_name: :return:

catalog_to_str()[source]
column_annotations_to_str(table)[source]
column_defs_to_str(table)[source]
foreign_key_defs_to_str(table)[source]
key_defs_to_str(table)[source]
schema_to_str(schema_name)[source]
substitute_variables(code)[source]

Factor out code and replace with a variable name. :param code: :return: new code

table_annotations_to_str(table)[source]
table_def_to_str()[source]
table_to_str(schema_name, table_name)[source]
tag_variables_to_str(annotations)[source]

For each convenient annotation name in tag_map, print out a variable declaration of the form annotation = v where v is the value of the annotation the dictionary. If the tag is not in the set of annotations, do nothing. :param annotations: :return:

variable_to_str(name, value, substitute=True)[source]

Print out a variable assignment on one line if empty, otherwise pretty print. :param name: Left hand side of assigment :param value: Right hand side of assignment :param substitute: If true, replace the group and tag values with their corresponding names :return:

class deriva.utils.catalog.manage.dump_catalog.DerivaDumpCatalogCLI(description, epilog)[source]

Bases: deriva.core.base_cli.BaseCLI

main()[source]
exception deriva.utils.catalog.manage.dump_catalog.DerivaDumpCatalogException(message)[source]

Bases: Exception

Base exception class for DerivaDumpCatalog.

exception deriva.utils.catalog.manage.dump_catalog.UsageException(message)[source]

Bases: deriva.utils.catalog.manage.dump_catalog.DerivaDumpCatalogException

Usage exception.

deriva.utils.catalog.manage.dump_catalog.main()[source]

deriva.utils.catalog.manage.graph_catalog module

class deriva.utils.catalog.manage.graph_catalog.DerivaCatalogToGraph(catalog)[source]

Bases: object

catalog_to_graph(schemas=None, skip_terms=False, skip_assocation_tables=False)[source]

Convert a catalog to a DOT based graph. :param schemas: List of schemas that should be included. Use whole catalog if None. :param skip_terms: Do not include term tables in the graph :param skip_assocation_tables: Collapse association tables so that only edges between endpoints are used :return:

foreign_key_defs_to_graph(table, skip_terms=False, skip_association_tables=False, schemas=[])[source]

Add edges for each foreign key relationship in the specified table. :param table: :param skip_terms: :param skip_association_tables: :param skip_schemas: :return:

save(filename=None, format='pdf', view=False)[source]
schema_to_graph(schema_name, schemas=[], skip_terms=False, skip_assocation_tables=False)[source]

Create a graph for the specified schema. :param schema_name: Name of the schema in the model to be used. :param schemas: List of additional schemas to include in the graph. :param skip_terms: :param skip_assocation_tables: :return:

view()[source]

deriva.utils.catalog.manage.update_catalog module

class deriva.utils.catalog.manage.update_catalog.CatalogUpdater(catalog)[source]

Bases: object

static update_acl_bindings(o, acl_bindings, merge=False)[source]
static update_acls(o, acls, merge=False)[source]
static update_annotations(o, annotations, merge=False)[source]
update_catalog(mode, annotations, acls, replace=False, merge=False)[source]
update_schema(mode, schema_def, replace=False, merge=False, really=False)[source]
update_table(mode, schema_name, table_def, replace=False, merge=False, really=False)[source]
exception deriva.utils.catalog.manage.update_catalog.CatalogUpdaterException(msg='Catalog Update Exception')[source]

Bases: Exception

deriva.utils.catalog.manage.update_catalog.parse_args(server, catalog_id, is_table=False, is_catalog=False)[source]

deriva.utils.catalog.manage.utils module

class deriva.utils.catalog.manage.utils.LoopbackCatalog(model=None)[source]

Bases: object

class LoopbackResult(uri, json=None)[source]

Bases: object

Class to simulate interactions with a catalog host.

json()[source]
raise_for_status()[source]
catalog_id
delete(uri)[source]
get(uri)[source]
getCatalogModel()[source]
get_server_uri()[source]
post(uri, json=None)[source]
put(uri, json=None, data=None)[source]
class deriva.utils.catalog.manage.utils.LoopbackModel(arg)[source]

Bases: deriva.core.ermrest_model.Model

apply(_)[source]

Apply catalog configuration to catalog unless existing already matches.

Parameters:existing – An instance comparable to self.

The configuration in self will be applied recursively to the corresponding model nodes in schema. For each node, the comment, annotations, acls, and/or acl_bindings will be applied where applicable.

If existing is not provided (default), the current whole configuration will be retrieved from the catalog and used automatically to determine whether the configuration goals under this CatalogConfig instance are already met or need to be remotely applied.

class deriva.utils.catalog.manage.utils.TempErmrestCatalog(scheme, server, **kwargs)[source]

Bases: deriva.core.ermrest_catalog.ErmrestCatalog

Create a new catalog. Can be used as as context so that catalog is automatically deleted.

deriva.utils.catalog.manage.utils.create_new_catalog(scheme, server, **kwargs)[source]

FUnction to create a new catalog in the specified host :param scheme: URL scheme to be used :param server: Server on which the catalog is to be created :param kwargs: Other DerivaServer arguments :return:

deriva.utils.catalog.manage.utils.load_module_from_path(file)[source]

Load configuration file from a path. :param file: :return: