A developer-focused alternative to custom pg_dump scriptswith Subveil.
Enterprise data tools and custom scripts offer different ways to prepare test data. With pg_dump and mysqldump, teams need to maintain their own selection and masking rules as schemas change. Subveil is a standalone CLI that subsets related rows, masks configured columns, and records copy details.
Some dump-and-scrub workflows write raw data to disk before masking. Review intermediate files, backups and relationship handling when designing your workflow.
The old way: Fragile bash scripts & post-load SQL updates
Graph-aware database subsetting that preserves foreign keys
Subveil reads foreign keys and builds a dependency graph to plan table order and select related rows. Cycles require special handling. Review the plan and verify foreign keys on the target, especially after schema changes.
Example dependency graph · load order
Circular foreign keys resolved in two passes
Self-references and mutual foreign keys have no valid linear order. Subveil detects each cycle, loads rows with the cyclic column deferred, then patches the references in a second pass or defers constraints; some schemas require additional target privileges.
two-pass resolvesql
01-- employees.manager_id → employees.id (self-referential)0203-- pass 1: insert rows, deferring the cyclic FK04INSERT INTO employees (id, name, manager_id) VALUES (1, 'A', NULL), (2, 'B', NULL);0506-- pass 2: patch the references once every row exists07UPDATE employees SET manager_id = 1 WHERE id = 2;
Deterministic masking for related columns
HMAC-based rules normally produce the same output for the same input, key and rule. Unique-column collision handling can choose a different variant, so review and test joins involving masked columns. Guards retry collisions where supported and fail if the available space is exhausted.