Skip to content
Preparing for DPDP in 2027? Explore our developer guide

Comparison & Migration · why switch

A developer-focused alternative to custom pg_dump scripts with 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.

Before & after

Stop writing unencrypted production dumps to disk.

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
refresh-staging.sh
bash
#!/usr/bin/env bash
# ❌ Fragile DIY staging refresh script
pg_dump "$PROD_DSN" --no-owner --exclude-table=audit_logs > /tmp/prod_raw.sql
​
# Breaks on new columns, JSONB blobs, and foreign-key constraints
psql "$STAGING_DSN" -f /tmp/prod_raw.sql
psql "$STAGING_DSN" -c "UPDATE users SET email = id || '@example.com', ssn = 'REDACTED';"
psql "$STAGING_DSN" -c "DELETE FROM orders WHERE created_at < now() - interval '30 days';"
# ERROR: update or delete on table "orders" violates foreign key constraint "payments_order_id_fkey"
rm -f /tmp/prod_raw.sql
  • • This example writes an unmasked dump to /tmp/prod_raw.sql
  • • Needs review when a new foreign-key table or JSON column is added
  • • Audit evidence depends on what the script records
The Subveil way: Graph-aware streaming & in-RAM masking
subveil pull
bash
# ✅ Zero-trust in-flight subsetting & masking (zero disk dumps)
subveil init --schemas public --out subveil.yaml
subveil plan --config subveil.yaml
subveil pull --config subveil.yaml -j 4
subveil verify --config subveil.yaml
​
# ✓ Resolved 42 tables across 6 foreign-key stages
# ✓ Masked 18 PII columns in RAM before target writes
# ✓ HMAC-authenticated local receipt recorded (run_id: 9d1c...e2f4)
  • • Masks PII in memory before a single byte touches the target database
  • • Automatically resolves foreign-key dependencies and circular references
  • • Emits a tamper-evident SHA-256 receipt and flags unmasked schema drift

Architectural comparison

Subveil vs. raw dumps, DB extensions & ETL suites.

See how Subveil's runner-based architecture compares across data residency, foreign keys, and setup overhead across PostgreSQL, MySQL, and MariaDB.

Architectural comparison between Subveil CLI and alternative database subsetting and masking approaches
Dimension
Subveil CLILocal runner
CLI + optional Cloud governance
Raw dump + SQL scriptspg_dump, mysqldump & bashIn-database extensionsDB-side masking pluginsEnterprise ETL suitesHeavy virtualization tools
Runs locally / zero rows leave network
Single local binary streams and masks on your own runner
Runs locally, but often writes raw intermediate dumps to disk
Runs inside database server; requires source or clone privileges
Typically relies on vendor-managed infrastructure or central servers
Requires DB extensions or source privileges
Zero DB extensions; read-only source connection + target load role
Needs dump binary and target superuser or disable-trigger rights
Requires installing and maintaining engine extensions in DB
Typically requires elevated agents, snapshots, or DB privileges
Foreign-key consistent subsetting
Automatic dependency graph, topological stages, and cycle handling
Manual SQL scripts break easily on cycles and schema drift
Focused on full-database masking rather than graph-aware subsetting
Supported on heavyweight enterprise platforms with complex config
PostgreSQL + MySQL + MariaDB
One CLI binary and consistent subveil.yaml workflow across all three
Separate pg_dump and mysqldump tooling and SQL dialects
Tied to a single database engine or extension ecosystem
Connector support and licensing vary per database engine
Versioned YAML policies & run receipts
Git-versioned YAML, drift alerts, and HMAC-authenticated receipts
Ad-hoc shell scripts with manual logging and no drift flags
Rules live inside database catalog state, not portable Git specs
Vendor audit logs tied to heavyweight control-plane suites
Setup time
Minutes: install CLI, run init/plan, and pull masked subsets
Hours to days authoring and debugging table order scripts
Requires DBA change windows, extension installs, and SQL setup
Weeks of procurement, architecture review, and agent deployment

Characteristics describe typical architectural trade-offs across each tool category and vary by implementation.

Under the hood

How Subveil keeps foreign keys intact.

Automated dependency graph resolution, deterministic HMAC transformers, and two-pass constraint loading.

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

Example table dependency graphTenants load first, followed by users and plans, then orders, then payments. Arrows illustrate example dependencies.tenantsusersplansorderspaymentsPASS 1PASS 2PASS 3PASS 4

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
-- employees.manager_id → employees.id (self-referential)-- pass 1: insert rows, deferring the cyclic FKINSERT INTO employees (id, name, manager_id) VALUES (1, 'A', NULL), (2, 'B', NULL);-- pass 2: patch the references once every row existsUPDATE 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.

same input → same outputtext
users.email        [email protected] → [email protected]billing.contact    [email protected] → [email protected]analytics.user     [email protected] → [email protected]

Zero-trust local CLI + Free Early Access Team Plan

Replace the script in an afternoon.

$ subveil pull --config subveil.yaml -j 4