Documentation

gomask export

Export routine from database to YAML

gomask export

Export a routine from the GoMask database to YAML format.

Synopsis

gomask export ROUTINE_IDENTIFIER [OPTIONS]

Description

The export command downloads a routine configuration from GoMask and saves it as a YAML file. This is useful for:

  • Backup: Save routine configurations before making changes
  • Version control: Export routines to commit them to git
  • Migration: Move routines between environments
  • Editing: Export, modify locally, then re-import

Arguments

ArgumentRequiredDescription
ROUTINE_IDENTIFIERYesThe routine ID (numeric) or unique identifier (string from routine.unique_id)

Options

OptionTypeDefaultDescription
--output, -o PATHpathstdoutOutput file path. If not specified, prints to stdout.
--force, -fflagfalseOverwrite existing file without prompting
--validateflagfalseValidate the exported YAML after generation

Examples

Export to File

gomask export customer-data-gen -o routine.yaml

Output:

Exporting routine 'customer-data-gen'...
✓ Exported to routine.yaml

Export to Stdout

gomask export customer-data-gen

Output:

routine:
  name: "Customer Data Generator"
  description: "Generates synthetic customer data"
  type: synthetic
  connector_id: 1
  unique_id: "customer-data-gen"

tables:
  - table_name: users
    schema_name: public
    hierarchy_level: 0
    target_record_count: 1000
    columns:
      - column_name: email
        generation_function: generate_email
    ...

Export by Numeric ID

gomask export 123 -o backup.yaml

Export with Validation

gomask export customer-data-gen -o routine.yaml --validate

Output:

Exporting routine 'customer-data-gen'...
✓ Exported to routine.yaml
Validating...
✓ Validation passed

Force Overwrite

gomask export customer-data-gen -o routine.yaml --force

Pipe to Another Command

gomask export customer-data-gen | yq '.tables[].table_name'

Output:

users
orders
products
order_items

Finding Routine Identifiers

List All Routines

gomask routines list

Output:

ID    Identifier          Name                    Type        Tables
───   ──────────────────  ──────────────────────  ──────────  ──────
123   customer-data-gen   Customer Data Generator Synthetic   4
124   pii-masking-prod    PII Masking Production  Masking     8
125   test-data-staging   Test Data Staging       Synthetic   3

Show Routine Details

gomask routines show customer-data-gen

Exported YAML Structure

The exported YAML includes:

routine:
  name: "Display Name"
  description: "Description text"
  type: synthetic  # or masking
  connector_id: 1
  unique_id: "unique-identifier"

settings:
  batch_size: 1000
  generation_mode: hierarchical
  runtime_parameter_definitions:
    - key: "param_record_count"
      name: "record_count"
      type: integer
      defaultValue: 1000
      description: "Parameter description"

tables:
  - table_name: table_name
    schema_name: public
    hierarchy_level: 0
    target_record_count: 1000
    columns:
      - column_name: column_name
        generation_function: function_name
        generation_parameters:
          - name: key
            value: value

Export vs Backup

FeatureExportBackup (web UI)
FormatYAMLJSON
Includes historyNoYes
Includes executionsNoYes
EditableYesNo
Version control friendlyYesNo

Workflow: Edit and Re-import

# 1. Export existing routine
gomask export customer-data-gen -o routine.yaml

# 2. Edit the YAML
vim routine.yaml

# 3. Validate changes
gomask validate routine.yaml

# 4. Re-import with update flag
gomask import routine.yaml --update

Exit Codes

CodeDescription
0Export successful
1Export failed (routine not found, permission denied, etc.)

Common Errors

Routine Not Found

Error: Routine 'unknown-routine' not found

Solutions:

  • Check the identifier with gomask routines list
  • Use the numeric ID instead of the string identifier
  • Verify you have access to the routine's team

File Already Exists

Error: File 'routine.yaml' already exists. Use --force to overwrite.

Solutions:

  • Use --force to overwrite
  • Specify a different output path

See Also