data_basedata_base_registerDataBaseRegister

DataBaseRegister

class data_base.data_base_register.DataBaseRegister(registry_basedir, search_dbs='on_first_init')

Two column registry mapping data bases to their locations.

This registry keeps track of all DataBase id tags and their locations on disk. This is useful when sharing data with other people, resolving relative database paths, and moving databases to other file systems. This registry implements an SQLite backend to store these locations and corresponding database IDs.

You can explicitly walk through a directory and add all DataBase it encounters to the registry with DataBaseRegister.search_dbs().

Parameters:
  • registry_basedir (str) – The location of the db registry

  • search_dbs (str|bool, optional) – Whether to look for data_bases in all subfolders of the registry’s directory. Defaults to “on_first_init”, which only does this if the registry is newly created.

Attributes:

registry_basedir

The location of the db registry

Type:

str

registry

The registry itself as an SQLite database.

Type:

SQLiteBackend

Methods:

search_dbs(directory)

Look for DataBase in all subfolders of the registry’s directory and add them to the registry.

add_db(unique_id, db_basedir)

Add a database to the registry.

keys()

Get all keys in the registry.