Inventory of PostGIS databases¶
DicoGIS connects to a database through a PostgreSQL connection service, lists the layers GDAL sees in it (tables and views with a geometry column) and reads their metadata like for the files: CRS, geometry type, fields, extent, number of features, and the comment of the table (COMMENT ON).
Services¶
The services are read from the pg_service.conf file used by libpq, QGIS and others:
the file given by the
PGSERVICEFILEenvironment variableelse,
pg_service.confin the folder given byPGSYSCONFDIRelse,
~/.pg_service.confon Linux and macOS,%APPDATA%\postgresql\.pg_service.confon Windows
For example:
[my_database]
host=localhost
port=5432
dbname=gis
user=reader
password=xxx
The password can be left out of the file and stored in the password file (.pgpass) instead.
Command line¶
--pg-services takes a service name, and can be repeated:
dicogis-cli inventory --pg-services my_database --pg-services another_one
A service missing from pg_service.conf is skipped with a warning.
With --input-folder too, the tables go into the same output as the files.
Without --output-path, the output is named after the services (or the folder, if any) and the date.
Graphical interface¶
In the Database tab, pick the service.

The PG service dropdown lists the services of pg_service.conf. Manage services… opens the editor of pgserviceparser to create, rename, copy, change or remove them. Creating, renaming, copying and removing a service are written at once to pg_service.conf; changed settings once Update service is clicked, a password in clear text too. Outside QGIS, the button is disabled where the QGIS Python bindings are importable (system Python with the QGIS packages, OSGeo4W shell), since the editor would mix two Qt bindings: edit pg_service.conf directly there. The editor is in English.
The Include views checkbox includes the views or not (GDAL >= 3.7). From the command line, views are always included.