Documentation

gomask import

Import YAML configuration to the database

gomask import

Import YAML configuration to the GoMask database.

Synopsis

gomask import YAML_FILE [OPTIONS]

Description

The import command uploads your YAML routine configuration to the GoMask platform. This creates (or updates) the routine in the database, making it available for:

  • Execution via the web UI
  • Execution via gomask run
  • Team collaboration
  • Scheduling and automation

The command automatically validates the YAML before importing unless --skip-validation is specified.

Arguments

ArgumentRequiredDescription
YAML_FILEYesPath to the YAML configuration file to import

Options

OptionTypeDefaultDescription
--env-file PATHpathnonePath to a .env file for variable substitution
--update, -uflagfalseUpdate existing routine if it already exists (matches by routine.unique_id)
--dry-runflagfalseValidate and show what would be imported without actually importing
--skip-validationflagfalseSkip schema validation before import
--param KEY=VALUEstringnoneOverride runtime parameters (can be specified multiple times)

Examples

Basic Import

gomask import routine.yaml

Output:

Validating routine.yaml...
✓ Validation passed

Importing routine...
✓ Routine created successfully

Routine Details:
  ID: 123
  Name: Customer Data Generator
  Unique ID: customer-data-gen
  Type: SyntheticRoutine
  Tables: 4

Update Existing Routine

gomask import routine.yaml --update

Output:

Validating routine.yaml...
✓ Validation passed

Importing routine...
✓ Routine 'customer-data-gen' updated successfully

Changes:
  - Record count: 500 → 1000
  - Added column: users.middle_name
  - Updated function: orders.total → calculate_total

Dry Run (Preview)

gomask import routine.yaml --dry-run

Output:

Validating routine.yaml...
✓ Validation passed

DRY RUN - No changes will be made

Would create routine:
  Name: Customer Data Generator
  Unique ID: customer-data-gen
  Type: SyntheticRoutine
  Tables: 4
    - users (500 records, 12 columns)
    - orders (1000 records, 8 columns)
    - products (200 records, 15 columns)
    - order_items (2500 records, 6 columns)

Run without --dry-run to import.

Import with Environment Variables

gomask import routine.yaml --env-file production.env

Import with Parameter Overrides

gomask import routine.yaml --param record_count=100 --param environment=staging

Import Behavior

New Routine

When importing a new routine:

  1. Creates a new routine in the database
  2. Returns the routine URL for web UI access
  3. Routine is immediately available for execution

Existing Routine (without --update)

Error: Routine 'Customer Data Generator' already exists.

Use --update to update the existing routine, or create a new routine with a different name.

Existing Routine (with --update)

When using --update:

  1. Finds the existing routine by routine.name
  2. Updates all configuration fields
  3. Preserves execution history
  4. Creates a new version in version history

Connector Handling

The routine.connector_id must reference an existing connector in GoMask:

routine:
  name: "My Routine"
  type: synthetic
  connector_id: 1  # Must be a valid connector ID

Use gomask connectors list to see available connectors and their IDs.

To create a new connector:

gomask connectors create --name "prod-postgres" --type postgresql --host db.example.com --database mydb --username user

Exit Codes

CodeDescription
0Import successful
1Import failed (validation error, already exists, permission denied, etc.)

Common Errors

Routine Already Exists

Error: Routine 'Customer Data Generator' already exists

Solutions:

  • Use --update to update the existing routine
  • Change the routine.name to create a new routine
  • Use gomask export to backup the existing routine first

Connector Not Found

Error: Connector with ID 1 not found

Solutions:

  • Create the connector with gomask connectors create
  • Check available connectors with gomask connectors list
  • Use a valid connector_id from your team's connectors

Permission Denied

Error: You don't have permission to create routines for this team

Solution: Contact your team administrator to grant appropriate permissions.

Best Practices

  1. Always validate first: Run gomask validate before importing
  2. Use dry-run: Preview changes with --dry-run before actual import
  3. Version control: Keep YAML files in git and import from CI/CD
  4. Use meaningful names: Choose descriptive routine.name values for easy identification

See Also