Skip to main content
A snapshot is a point-in-time capture of a subset of your database, packaged with everything needed to restore that exact data state to any compatible database.

What Makes a Snapshot

Basecut doesn’t just export tables—it creates self-contained, referentially-valid snapshots by following foreign key relationships. This ensures every snapshot can be applied to an empty database without constraint violations.

Key Characteristics

  1. Referentially Complete: Every row includes all its foreign key dependencies
  2. Point-in-Time: Captures database state at a specific moment
  3. Self-Contained: Includes schema metadata for validation
  4. Portable: Can be restored to any database with matching schema
  5. Versioned: Multiple versions can coexist for the same snapshot name

Snapshot Anatomy

Every snapshot consists of three required components and one optional component:

1. Manifest (manifest.json)

Contains metadata about the snapshot:
Purpose:
  • Identifies the snapshot uniquely
  • Records extraction context for debugging
  • Stores git metadata for reproducibility
  • Tracks performance metrics

2. Schema (schema.json)

Schema metadata for all included tables at extraction time. Purpose:
  • Validate target database compatibility before restore
  • Detect schema drift between snapshot and target
  • Document database structure at extraction time

3. Data Files (tables/*.csv.gz)

One compressed CSV file per table with extracted rows:
Format:
  • Standard CSV with header row
  • Gzip compressed for efficiency
  • NULL values represented as empty fields
  • Special characters escaped per RFC 4180

4. Warnings (warnings.json) - Optional

Only present if extraction encountered warnings:
Purpose:
  • Document extraction issues without failing
  • Warn users about partial data
  • Aid in debugging configuration problems

Snapshot Lifecycle

1. Creation

Local Execution (default):
Process:
  1. CLI reads configuration from basecut.yml
  2. Connects to source database
  3. Executes root queries to get seed rows
  4. Recursively follows foreign keys (upstream + downstream)
  5. Applies anonymization rules to PII fields
  6. Compresses data to CSV.gz files
  7. Generates manifest and schema metadata
  8. Uploads to configured storage (S3/GCS/local)

2. Storage

Snapshots are stored in your configured provider: S3 Example:
Name/tag references (for example dev-seed:brave-lion) are resolved via API metadata, not by directly constructing storage paths.

3. Restoration

Basic restore:
Process:
  1. CLI resolves snapshot version (:latestbrave-lion)
  2. Downloads manifest and schema from storage
  3. Validates target database schema compatibility
  4. Determines insertion order (respecting foreign keys)
  5. Inserts data in dependency order (or uses an automatic two-phase fallback for eligible nullable FK cycles)
  6. Verifies referential integrity
  7. Reports completion with row counts

Guarantees

Referential Integrity

Guarantee: Every snapshot is self-contained and referentially valid. What this means:
  • Every foreign key constraint will be satisfied after restore
  • No “dangling references” or broken relationships
  • Can restore to an empty database without errors
How it works:
  • Basecut tracks all foreign key relationships during extraction
  • Before including a row, ensures all referenced rows are included
  • If a parent is missing, adds it (even beyond depth limits)

Schema Preservation

Guarantee: Schema metadata is captured at extraction time. What this means:
  • Restore validates target schema matches snapshot schema
  • Detects missing tables, columns, or type changes
  • Prevents data corruption from schema drift

Size Estimation

Estimate snapshot size before creating:

Performance Characteristics

Creation Time


Snapshot vs Backup

Basecut is NOT a backup tool. Do not use snapshots as your database backup strategy.
Use snapshots for:
  • Seeding development databases
  • Sharing realistic test data with team
  • Reproducing production bugs locally
Use backups for:
  • Disaster recovery
  • Point-in-time recovery
  • Compliance archiving

Next Steps

How It Works

Deep dive into the extraction algorithm

Snapshot Versioning

Managing multiple versions of snapshots

Storage Providers

Configure S3, GCS, or local filesystem

CLI Reference

Complete command documentation