Repository and UnitOfWork

The ODA provides a UnitOfWork and Repository abstraction which should be the main interface to the ODA from within the OSO Python applications. The diagram below shows the expected architecture of OSO, and which applications will use the Repository interface.

../../_images/oso-deployment.jpg

The Repository and UnitOfWork are abstract classes that are implemented for each entity. They use a abstract bridge interface for the persistence, which has a single Postgres implementation.

The following environment variables are used to configure the Repository and UnitOfWork. For more details on setting these values inside the via the Helm chart for the ska-db-oda server, see Deployment to Kubernetes. A similar process should be in place for any application which imports the classes, e.g. ska-oso-services.

Environment variables used by Repository and UnitOfWork implementations

Environment variable

Relevant implementation

Description

Required/optional

PGHOST

postgres

The address of the PostgreSQL instance to connect to, e.g. 12.34.56.7

Required

PGPORT

postgres

The port of the PostgreSQL instance to connect to, e.g. 5432

Optional - default: 5432

PGDATABASE

postgres

The name of the database in the PostgreSQL instance, e.g. postgres

Optional - default: postgres

PGUSER

postgres

The admin user in the PostgreSQL instance, e.g. postgres

Optional - default: postgres

PGPASSWORD

postgres

The password for the admin user in the PostgreSQL instance.

Required

Note

This is a work in progress as is expected to be completed as part of BTN-2414