Skip to content

pg_lineage

AlohaDB temporal dataset fingerprints, model lineage and overlay branches

alohadb · AlohaDB temporal dataset fingerprints, model lineage and overlay branches

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
102462pg_lineagealohadb1.0FEATMITSQL

PostgreSQL · 18

Relationships
Requiresplpgsql

Usage

Sources:

pg_lineage 1.0 records reproducible dataset fingerprints, links model versions to datasets, and provides writable overlay branches over system-versioned tables.

These are preview modules of AlohaDB 21.2.0, a PostgreSQL 18 fork. Compatibility with stock PostgreSQL is not established.

Snapshot and Inspect

Install the SQL/PLpgSQL extension as a superuser. The source table must already be versioned by the matching AlohaDB pg_temporal or pg_bitemporal implementation. Same-named extensions from other projects are not interchangeable. No preload is required by pg_lineage itself.

CREATE EXTENSION pg_lineage;
SELECT * FROM lineage_snapshot('train_v3', ARRAY['customers'::regclass], 'training dataset');
SELECT lineage_link_model('churn', 'v3', 'train_v3', '{"auc":0.91}'::jsonb);
SELECT * FROM lineage_verify('train_v3');
SELECT * FROM lineage_read_snapshot(NULL::customers, 'train_v3');

The example assumes an existing versioned customers table. A snapshot stores a timestamp, row counts and content hashes; it does not copy or lock in the historical rows. Retaining temporal history and the relevant schema is necessary for reproduction. lineage_verify detects a changed or missing historical dataset; it does not repair it.

Branches and Maintenance

lineage_branch_create creates a view, delta table and tombstones over the base at a branch point, using a real primary key. Writes to the view change the overlay. lineage_branch_diff compares it with the base; lineage_branch_merge writes changes back with conflict checks. Its force=true option bypasses conflict refusal and needs separate review.

Operations run with caller permissions and require access to the base/history tables and schema objects. A branch is not database or tenant isolation. Drop branches with lineage_branch_drop and snapshot metadata with lineage_snapshot_drop; retain referenced history and real backups independently. The former name is alohadb_lineage.

Table reader