Skip to content

Quickstart

Prerequisites

  • A running PostgreSQL instance (any version supported by omop_alchemy's SQLAlchemy dialects)
  • pip install omop-alchemy (or an editable install from this repo)

Configure

omop-config init
omop-config configure omop_alchemy

See Configuration for the full field reference.


Running PostgreSQL tests locally

The test suite includes PostgreSQL-specific tests that skip automatically unless a test_cdm_db database is configured in ~/.config/omop/config.toml. Tests are marked with @pytest.mark.requires_database("test_cdm_db") and skipped at collection time when the database is absent — no manual filtering required.

This test database is destructive. The test suite drops and recreates the entire public schema on every run. test_cdm_db must point to a dedicated, empty test database, never to a database that contains real data. The test suite enforces this: it fails loudly (not skips) if the configured database is not marked test_only = true in your config.

Refer to the CI/CD workflows at cava-devops for more details on how integration test runs are typically orchestrated.

Step 1 — Register a test database connection:

omop-config configure omop_alchemy

When prompted whether to configure a test database, answer Y and supply the connection details for your dedicated test PostgreSQL instance. It will be saved as test_cdm_db with test_only = true.

Note on permissions: the test suite disables FK constraint triggers during bulk vocabulary loads, an operation PostgreSQL restricts to superusers. Ensure the test database user has superuser privileges, or provision the user manually with CREATE USER test SUPERUSER.

Step 2 — Run the tests:

pytest -v tests/

PostgreSQL tests auto-skip when test_cdm_db is not configured; all other tests run regardless.