Documentation

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:

  1. Lists your available database connectors
  2. Introspects the selected database schema
  3. Displays all tables with their relationships
  4. Helps you select tables for the routine
  5. Detects sensitive data (for masking) or assigns generators (for synthetic)
  6. 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

OptionTypeDefaultDescription
--output, -o PATHpathauto-generatedOutput YAML file path. If not specified, generates a filename like routine_<id>_complete.yaml
--no-waitflagfalseDon't wait for setup to complete. Returns immediately after starting.
--export-immediatelyflagfalseExport the configuration without waiting for user confirmation.
--skip-validationflagfalseSkip 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

  1. Review before running: Always review the generated YAML before executing
  2. Start small: Use a small record count initially, then scale up
  3. Customize functions: The auto-assigned functions are good defaults, but you may want to customize for specific business rules
  4. Version control: Commit the generated YAML to git for reproducibility

Exit Codes

CodeDescription
0Setup completed successfully
1Error during setup (cancelled, validation failed, etc.)
130Interrupted by user (Ctrl+C)

See Also