Skip to main content
This guide covers importing data into Ralph from various sources, including CSV files, XML, and migrating from Ralph 2.

Data Import Methods

Ralph supports data imports through:
  • Command Line Interface (CLI) - For automated and scripted imports
  • Graphical User Interface (GUI) - For interactive imports (feature in development)
  • Migration Tools - For upgrading from Ralph 2

CLI Import

The CLI importer supports various file formats and provides flexible import options.

Import from CSV File

Import a single CSV file for a specific model:

Import from ZIP Archive

Import multiple CSV files packaged in a ZIP archive:

Importer Options

View all available importer options:
Common Options:
  • --skipid - Skip existing IDs and generate new ones (recommended for imports from other systems)
  • --type - Import type: file or zip
  • --model_name - Django model name (required for file type)
  • --update - Update existing records instead of creating new ones
  • --dry-run - Test import without making changes

Import Examples

Migration from Ralph 2

If you’re upgrading from Ralph 2, you can export all your data and import it into Ralph 3.
Before starting migration:
  • Backup your Ralph 2 database
  • Test the migration on a staging environment first
  • Plan for downtime during the migration
  • Review data for any inconsistencies

Migration Process

1

Export Data from Ralph 2

On your Ralph 2 instance, export all data to a ZIP file:
This creates ralph2.zip containing CSV files for all models in the current directory.
The export includes all available models automatically. You don’t need to specify which models to export.
2

Transfer Export File

Transfer the ralph2.zip file to your Ralph 3 server.For Ubuntu installation:
For Docker installation:
3

Import to Ralph 3

Import the data into Ralph 3:Ubuntu:
Docker:
The --skipid option is critical for Ralph 2 migrations. It skips the old IDs from Ralph 2 and generates new ones in Ralph 3, preventing ID conflicts.
4

Verify Import

After import completes:
  1. Log into Ralph 3 web interface
  2. Verify that your data appears correctly
  3. Check record counts match expectations
  4. Test key workflows and reports
5

Handle Import Errors (if any)

If the import fails with errors:
  1. Review error messages to identify data issues
  2. Fix problems in Ralph 2 (e.g., missing required fields)
  3. Clean your Ralph 3 database:
  4. Re-run the import
The flush command deletes all data from the database. Only use this during initial migration testing.

CSV File Format

When preparing CSV files for import:

File Structure

  • Encoding: UTF-8
  • Delimiter: Comma (,)
  • Quote Character: Double quote (")
  • Header Row: Required, contains field names matching model fields

Example CSV Structure

Field Mapping

  • Use exact model field names from Ralph’s database schema
  • For foreign keys, use the primary key value or natural key
  • Date fields should use ISO format: YYYY-MM-DD
  • DateTime fields: YYYY-MM-DD HH:MM:SS

Handling Relationships

Foreign Keys:
Many-to-Many Relationships:

GUI Import

The graphical import interface is currently under development. Use CLI import for now.
The GUI import feature will provide:
  • Visual file upload interface
  • Field mapping tools
  • Import preview and validation
  • Progress tracking
  • Error reporting

Import Best Practices

Always test imports on a staging environment:
  1. Set up a test Ralph instance
  2. Import your data
  3. Verify results
  4. Document any issues or required adjustments
  5. Only then import to production
Clean your data before importing:
  • Remove duplicate records
  • Ensure required fields have values
  • Validate foreign key references
  • Check data format consistency
  • Verify date/time formats
Test imports without making changes:
Review the output to identify potential issues.
When importing related data:
  1. Import parent/reference tables first (e.g., Manufacturers, Models)
  2. Then import dependent tables (e.g., Assets)
  3. Finally import relationships (e.g., Licenses, Assignments)
Maintain copies of:
  • Original export files
  • Modified/cleaned CSV files
  • Import logs and error messages
  • Database backups before import

Troubleshooting

Common Import Errors

Problem: Referenced objects don’t existSolution: Import parent tables before child tables, or update foreign key values to match existing records
Problem: Records with same unique identifier already existSolution: Use --skipid flag to generate new IDs, or --update to update existing records
Problem: CSV missing required columnsSolution: Add missing columns to CSV or provide default values
Problem: Special characters appear incorrectlySolution: Ensure CSV files are UTF-8 encoded

Import Performance

For large datasets:
  • Import during off-peak hours
  • Disable unnecessary background tasks
  • Temporarily increase database connection limits
  • Monitor system resources (CPU, RAM, disk I/O)
  • Consider splitting very large files into smaller batches

Getting Import Logs

Ubuntu:
Docker:

Export Data from Ralph 3

You can also export data from Ralph 3 for backup or transfer:
This creates a ZIP file with CSV exports of all models.

Next Steps

After successful data import:
  1. Verify data integrity - Check that all records imported correctly
  2. Set up permissions - Configure user access and roles
  3. Configure workflows - Set up asset lifecycle transitions
  4. Train users - Familiarize your team with Ralph 3
  5. Monitor performance - Watch for any issues with imported data

Configuration Guide

Configure LDAP, caching, and other advanced features