Skip to content

Quickstart Guide

Get Skifta up and running in 5 minutes. This guide walks you through masking your first SQL dump.

Prerequisites

Before starting, make sure Skifta is installed. If not, follow the Installing guide.

Step 1: Create a Configuration File

Navigate to your project directory and initialize a Skifta config:

bash
skifta init

This generates a skifta.toml file with example configurations. The file defines:

  • SQL dialect (postgres, mysql, sqlite)
  • Tables and columns to transform
  • Transformers to apply to each column

Step 2: Configure Your Transformations

Open skifta.toml and customize it for your database schema.

Example: Masking a Users Table

toml
dialect = "postgres"

[[table]]
name = "users"
columns = [
  { name = "email", transformer = "email" },
  { name = "first_name", transformer = "name" },
  { name = "last_name", transformer = "name" },
  { name = "phone", transformer = "phone-number" }
]

Example: Multi-Table Configuration

toml
dialect = "postgres"

[[table]]
name = "users"
columns = [
  { name = "email", transformer = "email" },
  { name = "full_name", transformer = "name" }
]

[[table]]
name = "orders"
columns = [
  { name = "shipping_address", transformer = "lipsum" }
]

[[table]]
name = "payments"
columns = [
  { name = "credit_card", transformer = "credit-card" }
]

Browse all available transformers to see what you can mask.

Step 3: Run the Transformation

Transform your SQL dump with a single command:

bash
skifta -i production-dump.sql -o anonymized-dump.sql

What happens:

  1. Skifta parses your SQL dump according to the specified dialect
  2. Identifies INSERT statements for configured tables
  3. Transforms specified columns using the configured transformers
  4. Outputs a new SQL file with masked data

Alternative: Stream to stdout

If you prefer working with pipes:

bash
skifta -i production-dump.sql > anonymized-dump.sql

Step 4: Verify the Output

Check the anonymized dump to ensure transformations worked as expected:

bash
# Quick preview of transformed data
head -n 50 anonymized-dump.sql

# Or import into a test database
psql test_db < anonymized-dump.sql

Common Use Cases

Scenario: Sharing Data with External Developers

bash
# 1. Export production data
pg_dump production_db > prod-dump.sql

# 2. Mask PII with Skifta
skifta -i prod-dump.sql -o safe-dump.sql

# 3. Share safe-dump.sql with contractors

Scenario: Creating Test Fixtures

bash
# 1. Dump a subset of production data
pg_dump --table=users --table=orders production_db > subset.sql

# 2. Anonymize for CI/CD
skifta -i subset.sql -o test-fixtures.sql

# 3. Use in your test suite

What's Next?

Need Help?