Deriva Ermrest Catalog Examples

This notebook gives examples of creating and connecting to ERMrest catalogs.


In [1]:
from deriva.core import DerivaServer, get_credential

Fill in your desired scheme, hostname and catalog number.


In [2]:
scheme = 'https'
hostname = 'dev.isrd.isi.edu'
catalog_number = 1

Use DERIVA-Auth to get a credential or use None if your catalog allows anonymous access.


In [3]:
#credential = None
credential = get_credential(hostname)

Get a handle representing your server.


In [4]:
server = DerivaServer(scheme, hostname, credential)

Connect to a catalog, and list its schemas.


In [5]:
catalog = server.connect_ermrest(catalog_number)
pb = catalog.getPathBuilder()
list(pb.schemas)


Out[5]:
['legacy', 'isa', 'load_temp', 'vocabulary', 'metadata_raw', 'public']

Create a new catalog.


In [6]:
new_catalog = server.create_ermrest_catalog()
new_catalog_pb = new_catalog.getPathBuilder()
list(new_catalog_pb.schemas)


Out[6]:
['public']

In [ ]: