Create Command#

Help#

The help text for the create subcommand can be shown by passing the -h flag.

[1]:
%%bash
metacatalog create -h
usage: metacatalog create [-h] [--version] [--connection CONNECTION]
                          [--verbose] [--quiet] [--dev] [--logfile LOGFILE]

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.

Creating tables#

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.

Note

The create command has the purpose of creating metacatalog into a fresh installation. If you want to update the database, refer to the migration section (place link here).

If no --connection or -C flag is given, the default connection URI will be loaded from metacatalog’s config file.

Prerequisites#

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. Installing PostGIS does need further installation steps on the host system, which are dependent on the host OS. Refer to PostGIS website for further explanations.

With everything installed, the database and PostGIS extension can be created like:

CREATE DATABASE metacatalog;

Connect to that database and run:

CREATE EXTENSTION postgis;

You can verify that installation succeeded if the following query yields the installed version:

SELECT PostGIS_full_version();
"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"

See Also#