Populate defaults#

metacatalog.api.populate_defaults(session: Session, ignore_tables: List[str] = [], bump_sequences: int = 10000) None#

Populates many lookup and auxiliary tables with useful default information. The actual data is read from a data subdirectory inside this module and can therefore easily be adapted. Any table name supplied in ignore_tables will be omitted.

Warning

Do only ignore tables if you know what you are doing. There are dependencies (like variables, units and keywords) and some of the API is depending on some defaults (like datatypes).

As of now, the following tables can be pre-polulated:

  • datasource_types

  • datatypes

  • entrygroup_types

  • keywords

  • licenses

  • person_roles

  • thesaurus

  • units

  • variables

Parameters:
  • session (sqlalchemy.Session) – Session instance connected to the database.

  • ignore_tables (list) – List of tables to be omitted. Be aware that the actual table name in the database has to be supplied, not the name of the model in Python.

  • bump_sequences (int, None) – If integer (default), the primary key sequences will be set to this value. It is recommended to use a high value like the default 10,000 to allow for future including of new pre-populated values. Otherwise, these might have integrity conflicts with your database objects.