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
| Argument | Required | Description |
|---|---|---|
YAML_FILE | Yes | Path to the YAML configuration file to import |
Options
| Option | Type | Default | Description |
|---|---|---|---|
--env-file PATH | path | none | Path to a .env file for variable substitution |
--update, -u | flag | false | Update existing routine if it already exists (matches by routine.unique_id) |
--dry-run | flag | false | Validate and show what would be imported without actually importing |
--skip-validation | flag | false | Skip schema validation before import |
--param KEY=VALUE | string | none | Override 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:
- Creates a new routine in the database
- Returns the routine URL for web UI access
- 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:
- Finds the existing routine by
routine.name - Updates all configuration fields
- Preserves execution history
- 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
| Code | Description |
|---|---|
| 0 | Import successful |
| 1 | Import failed (validation error, already exists, permission denied, etc.) |
Common Errors
Routine Already Exists
Error: Routine 'Customer Data Generator' already exists
Solutions:
- Use
--updateto update the existing routine - Change the
routine.nameto create a new routine - Use
gomask exportto 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_idfrom 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
- Always validate first: Run
gomask validatebefore importing - Use dry-run: Preview changes with
--dry-runbefore actual import - Version control: Keep YAML files in git and import from CI/CD
- Use meaningful names: Choose descriptive
routine.namevalues for easy identification