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:
| Engine | Driver name | DSN format |
|---|---|---|
| MySQL | mysql | user:pass@tcp(host:3306)/dbname |
| Postgres | postgres | postgres://user:pass@host:5432/dbname?sslmode=require |
| PlanetScale | planetscale | MySQL DSN against the PlanetScale host (TLS required). |
| Postgres (slot-less) | postgres-trigger | Same as postgres; pairs with trigger setup. |
Environment variables
Keep credentials out of your shell history by passing DSNs via the environment:
| Variable | Equivalent 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:
| Flag | Default | Purpose |
|---|---|---|
--config, -c | — | Path to a YAML config file. |
--log-level, -l | info | Verbosity: debug / info / warn / error. |
--pprof-listen | off | Bind net/http/pprof at an address to diagnose stalls (e.g. :6060). |
--mysql-sql-mode | strict | Override sluice's forced strict sql_mode. Pass '' (empty) to migrate legacy MySQL data with zero-dates. |
--version, -V | — | Print 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.