sluice

Configuration

Connection strings, environment variables, the YAML config file, and the global flags every command shares.

Connection strings

Every data-moving command takes a source and target driver + DSN:

EngineDriver nameDSN format
MySQLmysqluser:pass@tcp(host:3306)/dbname
Postgrespostgrespostgres://user:pass@host:5432/dbname?sslmode=require
PlanetScaleplanetscaleMySQL DSN against the PlanetScale host (TLS required).
Postgres (slot-less)postgres-triggerSame as postgres; pairs with trigger setup.

Environment variables

Keep credentials out of your shell history by passing DSNs via the environment:

VariableEquivalent flag
SLUICE_SOURCE--source
SLUICE_TARGET--target

YAML config file

For anything beyond a handful of flags, pass a YAML file with --config / -c. CLI flags take precedence over config values. Common keys:

# sluice.yaml
include_tables: ["app_*"]
exclude_tables: ["app_audit"]

# force target column types (CLI: --type-override)
mappings:
  - column: products.attrs
    type: jsonb
    binary: true

# replace generated-column bodies verbatim (CLI: --expr-override)
expression_mappings:
  - column: orders.total_cents
    expression: "(price_cents * qty)"

# PII redaction (CLI: --redact)
redactions:
  - rule: users.email=hash:sha256
  - rule: users.ssn=mask:ssn

# dictionaries referenced by tokenize:dict / randomize:dict strategies
dictionaries:
  first_names:
    values: ["Alex", "Sam", "Jordan"]

Then run, for example:

sluice migrate -c sluice.yaml --source-driver mysql --source ... --target-driver postgres --target ...

Global flags

These apply to every command:

FlagDefaultPurpose
--config, -cPath to a YAML config file.
--log-level, -linfoVerbosity: debug / info / warn / error.
--pprof-listenoffBind net/http/pprof at an address to diagnose stalls (e.g. :6060).
--mysql-sql-modestrictOverride sluice's forced strict sql_mode. Pass '' (empty) to migrate legacy MySQL data with zero-dates.
--version, -VPrint version and exit.
Migrating legacy MySQL data? sluice forces a strict sql_mode on every MySQL connection to close the silent-clamp / silent-zero-date class. Data that was only accepted under a relaxed mode (pre-5.7 zero-dates, silently-truncated values) will refuse loudly — pass --mysql-sql-mode='' to fall through to the server default.