gomask setup
Interactive wizard to create routines from database introspection
gomask setup
Interactive wizard to create routines from database introspection.
Synopsis
gomask setup [OPTIONS]
Description
The setup command provides an interactive wizard that:
- Lists your available database connectors
- Introspects the selected database schema
- Displays all tables with their relationships
- Helps you select tables for the routine
- Detects sensitive data (for masking) or assigns generators (for synthetic)
- Generates a complete, production-ready YAML configuration
This is the recommended way to create new routines as it automatically handles:
- Foreign key relationship detection
- Table hierarchy ordering
- Appropriate function assignment per column type
- Sensitive data detection for masking routines
Options
| Option | Type | Default | Description |
|---|---|---|---|
--output, -o PATH | path | auto-generated | Output YAML file path. If not specified, generates a filename like routine_<id>_complete.yaml |
--no-wait | flag | false | Don't wait for setup to complete. Returns immediately after starting. |
--export-immediately | flag | false | Export the configuration without waiting for user confirmation. |
--skip-validation | flag | false | Skip YAML schema validation after generation. |
Interactive Workflow
Step 1: Select Connector
Available Connectors:
1. prod-postgres (PostgreSQL)
2. staging-mysql (MySQL)
3. dev-local (PostgreSQL)
Select connector [1-3]: 1
Step 2: Select Schema
Available Schemas:
1. public
2. sales
3. inventory
Select schema [1-3]: 1
Step 3: Select Tables
Tables in 'public' schema:
1. users (12 columns)
2. orders (8 columns)
3. products (15 columns)
4. order_items (6 columns)
5. categories (4 columns)
Select tables (e.g., 1-3, 1,3,5, or 'all'): 1-4
Step 4: Choose Routine Type
Routine Type:
1. Synthetic Data Generation
2. Data Masking
Select type [1-2]: 1
Step 5: Configuration
For Synthetic Data:
Analyzing tables for data generation...
✓ users: 12 columns configured
✓ orders: 8 columns configured
✓ products: 15 columns configured
✓ order_items: 6 columns configured
Default record count per table: 1000
Enter record count (or press Enter for default): 500
For Data Masking:
Detecting sensitive data...
✓ users.email: Email detected → mask_email
✓ users.phone: Phone detected → mask_phone
✓ users.ssn: SSN detected → mask_ssn
✓ orders.credit_card: Credit card detected → mask_credit_card
Found 4 sensitive columns. Review and confirm.
Step 6: Export
Configuration complete!
Exporting to: routine_563_complete.yaml
✓ YAML file generated
✓ Validation passed
Next steps:
1. Review: cat routine_563_complete.yaml
2. Edit if needed: vim routine_563_complete.yaml
3. Run: gomask run routine_563_complete.yaml --watch
Examples
Basic Interactive Setup
gomask setup
Specify Output File
gomask setup --output my-routine.yaml
Quick Export Without Confirmation
gomask setup --export-immediately
Skip Validation (Advanced)
gomask setup --skip-validation
Generated YAML Structure
The wizard generates a complete YAML file like:
routine:
name: "Generated Routine"
type: synthetic
description: "Auto-generated from database introspection"
connector_id: 1
unique_id: "routine-563"
settings:
generation_mode: hierarchical
batch_size: 1000
tables:
- table_name: users
schema_name: public
hierarchy_level: 0
target_row_count: 500
columns:
- column_name: id
generation_function: sequential_integer
generation_parameters:
start: 1
- column_name: email
generation_function: generate_email
- column_name: first_name
generation_function: generate_first_name
# ... all columns configured
- table_name: orders
schema_name: public
hierarchy_level: 1
target_row_count: 500
columns:
- column_name: user_id
generation_function: reference
generation_parameters:
table: users
column: id
# ... all columns configured
Best Practices
- Review before running: Always review the generated YAML before executing
- Start small: Use a small record count initially, then scale up
- Customize functions: The auto-assigned functions are good defaults, but you may want to customize for specific business rules
- Version control: Commit the generated YAML to git for reproducibility
Exit Codes
| Code | Description |
|---|---|
| 0 | Setup completed successfully |
| 1 | Error during setup (cancelled, validation failed, etc.) |
| 130 | Interrupted by user (Ctrl+C) |