Data Machine provides comprehensive import/export functionality for pipeline configurations, enabling backup, migration, and sharing of workflow templates across installations.
The import/export system handles pipeline structures including steps, configurations, and associated flow data. All operations are performed through WordPress actions and are accessible via the REST API.
Pipeline export generates a CSV file containing complete pipeline and flow configuration data:
pipeline_id,pipeline_name,step_position,step_type,step_config,flow_id,flow_name,handler,settings
1,"News Pipeline",0,"fetch","{""step_type"":""fetch"",""handler_slug"":""rss""}","","","",""
1,"News Pipeline",0,"fetch","{""step_type"":""fetch"",""handler_slug"":""rss""}",2,"Daily News","rss","{""url"":""https://example.com/feed""}"The CSV export includes two types of rows:
- Pipeline Structure Rows: Define the pipeline steps and their configurations
- Flow Configuration Rows: Detail how each flow implements the pipeline steps with specific handlers and settings
// Export specific pipelines
do_action('datamachine_export', 'pipelines', [1, 2, 3]);
// Access export result
$csv_data = apply_filters('datamachine_export_result', '');Pipeline import processes CSV data to recreate pipeline structures and flow configurations:
- Parses CSV rows to identify pipeline names and step configurations
- Creates pipelines if they don't exist
- Adds pipeline steps with proper execution ordering
- Maintains flow-specific handler configurations
// Import CSV data
do_action('datamachine_import', 'pipelines', $csv_content);
// Access import result
$result = apply_filters('datamachine_import_result', []);
// Returns: ['imported' => [1, 2, 3]] - array of imported pipeline IDs- Pipeline Creation: Automatically creates pipelines with default flow configurations
- Step Synchronization: Adds steps to existing pipelines without duplication
- Flow Preservation: Maintains existing flow configurations while adding new pipeline steps
- Error Handling: Skips invalid rows and logs issues for troubleshooting
All import/export operations require manage_options capability, ensuring only administrators can perform these actions.
Regularly export pipeline configurations for backup purposes, enabling quick restoration after updates or migrations.
Export pipelines from development environments and import into production systems.
Share pipeline templates between different WordPress installations or team members.
Store pipeline configurations in external version control systems for change tracking.
- CSV Format: Standard CSV with proper escaping for complex JSON configurations
- Execution Ordering: Pipeline steps are sorted by
execution_orderduring export - Flow Isolation: Each flow's handler configurations are preserved independently
- Database Integration: Import/export is implemented by
DataMachine\Engine\Actions\ImportExportand surfaced throughinc/Abilities/Pipeline/ImportExportAbility.php; REST, CLI, and ability callers all route through that same action layer.