{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Populate command" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Help\n", "The help text for the `populate` subcommand can be shown by passing the `-h` flag." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "usage: metacatalog populate [-h] [--version] [--connection CONNECTION]\n", " [--verbose] [--quiet] [--dev] [--logfile LOGFILE]\n", " [--ignore IGNORE [IGNORE ...]]\n", "\n", "optional arguments:\n", " -h, --help show this help message and exit\n", " --version, -v Returns the module version\n", " --connection CONNECTION, -C CONNECTION\n", " Connection string to the database instance.Follows the\n", " syntax: driver://user:password@host:port/database\n", " --verbose, -V Activate extended output.\n", " --quiet, -q Suppress any kind of output.\n", " --dev Development mode. Unexpected errors will not be\n", " handled and the full traceback is printed to the\n", " screen.\n", " --logfile LOGFILE If a file is given, output will be written to that\n", " file instead of printed to StdOut.\n", " --ignore IGNORE [IGNORE ...], -I IGNORE [IGNORE ...]\n", " List tables to be ignored for default population.\n" ] } ], "source": [ "%%bash\n", "metacatalog populate -h" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Usage" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "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.\n", "\n", "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:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{'datasource_types': ,\n", " 'datatypes': ,\n", " 'entrygroup_types': ,\n", " 'keywords': ,\n", " 'licenses': ,\n", " 'person_roles': ,\n", " 'thesaurus': ,\n", " 'units': ,\n", " 'variables': }\n" ] } ], "source": [ "from pprint import pprint\n", "from metacatalog.api.db import IMPORTABLE_TABLES\n", "pprint(IMPORTABLE_TABLES)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Prerequisites\n", "\n", "It is assumed that `create` was executed before." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Related commands\n", "\n", "In many scenarios you run rather the `metacatalog init` command, which runs `create` and `populate` at the same time. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## See also\n", "\n", "* [create command](cli_create.ipynb)\n", "* [init command](cli_init.ipynb)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.7" } }, "nbformat": 4, "nbformat_minor": 4 }