{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Create Command" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Help\n", "The help text for the `create` 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 create [-h] [--version] [--connection CONNECTION]\n", " [--verbose] [--quiet] [--dev] [--logfile LOGFILE]\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" ] } ], "source": [ "%%bash\n", "metacatalog create -h" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Creating tables" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The create command will create all necessary tables in the connected database. It will **not** fail if the tables are already present and create missing table. However, table changes are **not** reflected." ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ ".. note::\n", " \n", " The ``create`` command has the purpose of creating metacatalog into a **fresh installation**. \n", " If you want to update the database, refer to the migration section (place link here)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If no ``--connection`` or ``-C`` flag is given, the default connection URI will be loaded from metacatalog's config file." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Prerequisites" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Metacatalog does neither install the database, nor the PostGIS extension. We assume that the user specified in the connection string has granted full rights on the given database, but no super-user rights and no right to create addiontional databases. \n", "Installing PostGIS does need further installation steps on the host system, which are dependent on the host OS. Refer to [PostGIS website](https://postgis.net/) for further explanations." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "With everything installed, the database and PostGIS extension can be created like:\n", "\n", "```SQL\n", "CREATE DATABASE metacatalog;\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Connect to that database and run:\n", "\n", "```sql\n", "CREATE EXTENSTION postgis;\n", "```\n", "\n", "You can verify that installation succeeded if the following query yields the installed version:\n", "\n", "```sql\n", "SELECT PostGIS_full_version();\n", "```\n", "\n", "```\n", "\"POSTGIS=\"2.4.4 r16526\" PGSQL=\"100\" GEOS=\"3.7.1-CAPI-1.11.1 27a5e771\" PROJ=\"Rel. 4.9.3, 15 August 2016\" GDAL=\"GDAL 2.2.3, released 2017/11/20\" LIBXML=\"2.9.4\" LIBJSON=\"0.12.1\" LIBPROTOBUF=\"1.2.1\" RASTER\"\n", "```" ] }, { "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": { "raw_mimetype": "text/restructuredtext" }, "source": [ "## See Also\n", "\n", "* [init command](cli_init.ipynb)\n", "* [populate command](cli_populate.ipynb)" ] } ], "metadata": { "celltoolbar": "Raw Cell Format", "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 }