Table of Contents

Graphlytic uses an embedded backend database by default (HSQL DB). However, external PostgreSQL is also supported.

1. How to set up a PostgreSQL connection

Prerequisites:

  1. The database needs to be already created. (Example script: “CREATE DATABASE graphlytic;”)

  2. Graphlytic needs to be run with the GRAPHLYTIC_DATABASE_DIALECT=postgres variable

When all prerequisites are fulfilled, Graphlytic tries to connect to PostgreSQL with the default values. Default values can be modified with environment variables:

Parameter

Description

Supported dialects

Default value for dialect postgres

GRAPHLYTIC_DATABASE_DIALECT

Supported values are:
hsql, postgres

hsql postgres

postgres

GRAPHLYTIC_DATABASE_SCHEMA

Database Schema where Graphlytic metadata will be stored. Use uppercase letters for the “hsql” dialect and lowercase letters for the “postgres” dialect.

hsql postgres

graphlytic

GRAPHLYTIC_DATABASE_NAME

Database name. This database needs to be created manually before running graphlytic.

postgres

graphlytic

GRAPHLYTIC_DATABASE_USERNAME

Username needed for database authentication.

postgres

postgres

GRAPHLYTIC_DATABASE_PASSWORD

A password for the database authentication.

postgres

postgres

GRAPHLYTIC_DATABASE_HOST

Database domain name with path (if applicable).

postgres

localhost

GRAPHLYTIC_DATABASE_PORT

Database port.

postgres

5432

2. How to migrate from HSQL DB to PostgreSQL

Graphlytic version 5.2 or later must be used. If you have an older version, please first upgrade to the latest version of Graphlytic.

To migrate an existing HSQL DB to PostgreSQL, please follow these steps:

  1. Run Graphlytic with the “postgres” dialect (see chapter above).

  2. Open the API page in Graphlytic and find the POST /migrate service in the “Other” group.

  3. Click on the “Try it out” button.

  4. Enter the full path to the db_hsql folder that should be migrated to PostgreSQL.

  5. Click on “Execute”. In case of a successful migration, the return code is 200.

Migration is done using UPSERT commands. This means that all records from the HSQL DB are added to the existing records in PostgreSQL. If an ID conflict occurs, an update of the existing record is performed.