Upgrading the Senzing Repository Schema to v4

This article is for general guidance. Always test any updates and changes in a non-production system before implementing them in production! If you have a working Senzing system with data and insight you do not wish to lose, or are unsure of any steps please contact Senzing Support . Support is 100% FREE!

When upgrading from Senzing v3 to Senzing v4, there are changes made to the entity repository database schema. The database(s) used by Senzing must be updated accordingly.

This is the first of two steps. After the schema is upgraded, continue to Upgrade ER Config to v4 .

Database upgrade SQL scripts

Upgrade scripts for the Senzing entity repository are provided as part of the SDK packages. They provide the SQL statements needed to upgrade the database and are named with the database type and SDK version numbers, for example:

szcore-schema-postgresql-upgrade-3.0-to-4.0.sql

Each SQL script file contains the SQL statements needed to update the database from one major version to the next, for a specific database vendor.

Generating complete scripts

The sz_dbtool utility, available in bin/, performs the repository schema upgrade.

The tool locates the repository from the first of these it finds:

  1. -c <INI file>, an explicit sz_engine_config.ini . Use when the engine configuration you want is not the one the environment already points at.
  2. SENZING_ENGINE_CONFIGURATION_JSON .
  3. SENZING_ROOT, set by a project’s setupEnv, which resolves to that project’s own sz_engine_config.ini .

Example syntax:

sz_dbtool upgrade -o <outputDirectory>

Example syntax with example parameters:

sz_dbtool upgrade -o ~/outputDir

This command generates the SQL upgrade script file from the current repository version to the current Senzing v4 engine version.

Review the generated script, then have your DBA run it against the database. For a v3 repository the plan reports 3.0 -> 4.0, and once the script has run the repository schema version becomes 4.0.

sz_dbtool also reports schema drift, such as a missing index, against a live database:

sz_dbtool analyze

The sz_dbupgrade utility, available in <project_path>/bin, is used to compute full database update scripts; even when crossing several versions or using multiple database types.

Example syntax:

sz_dbupgrade -c <INI file> -o <outputDirectory>

Example syntax with example parameters:

sz_dbupgrade -c ~/senzing/etc/sz_engine_config.ini -o ~/outputDir

This command generates the SQL upgrade script file from the current repository version to the current Senzing v4 engine version.

Precautions

sz_dbtool defaults to a dry run, writing the generated SQL to stdout or to -o <outputDirectory>. It applies changes to the database only when passed --apply.

Applying changes directly is not recommended in production. Create the scripts first and review them with your DBA to gauge the specific operational impact any changes might have.

sz_dbupgrade can perform the database update itself with the -a argument and no -o argument.

Applying changes directly is not recommended in production. Create the scripts first and review them with your DBA to gauge the specific operational impact any changes might have.

Next step

With the schema at 4.0, continue to Upgrade ER Config to v4 to upgrade the entity resolution configuration.

If you have any questions, contact Senzing Support. Support is 100% FREE!