Populate command#
Help#
The help text for the populate
subcommand can be shown by passing the -h
flag.
[1]:
%%bash
metacatalog populate -h
usage: metacatalog populate [-h] [--version] [--connection CONNECTION]
[--verbose] [--quiet] [--dev] [--logfile LOGFILE]
[--ignore IGNORE [IGNORE ...]]
optional arguments:
-h, --help show this help message and exit
--version, -v Returns the module version
--connection CONNECTION, -C CONNECTION
Connection string to the database instance.Follows the
syntax: driver://user:password@host:port/database
--verbose, -V Activate extended output.
--quiet, -q Suppress any kind of output.
--dev Development mode. Unexpected errors will not be
handled and the full traceback is printed to the
screen.
--logfile LOGFILE If a file is given, output will be written to that
file instead of printed to StdOut.
--ignore IGNORE [IGNORE ...], -I IGNORE [IGNORE ...]
List tables to be ignored for default population.
Usage#
The populate
command will load some default values for a set of lookup tables into the (default) database instanstance defined. You can omit tables by passing their table names using the --ignore
flag.
The tables that have default values and will be imported are mapped to their model class in a dict called IMPORTABLE_TABLES
, which is printed below:
[2]:
from pprint import pprint
from metacatalog.api.db import IMPORTABLE_TABLES
pprint(IMPORTABLE_TABLES)
{'datasource_types': <class 'metacatalog.models.datasource.DataSourceType'>,
'datatypes': <class 'metacatalog.models.datasource.DataType'>,
'entrygroup_types': <class 'metacatalog.models.entrygroup.EntryGroupType'>,
'keywords': <class 'metacatalog.models.keyword.Keyword'>,
'licenses': <class 'metacatalog.models.license.License'>,
'person_roles': <class 'metacatalog.models.person.PersonRole'>,
'thesaurus': <class 'metacatalog.models.keyword.Thesaurus'>,
'units': <class 'metacatalog.models.variable.Unit'>,
'variables': <class 'metacatalog.models.variable.Variable'>}
Prerequisites#
It is assumed that create
was executed before.
Related commands#
In many scenarios you run rather the metacatalog init
command, which runs create
and populate
at the same time.