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:--skipid- Skip existing IDs and generate new ones (recommended for imports from other systems)--type- Import type:fileorzip--model_name- Django model name (required forfiletype)--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.Migration Process
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.Transfer Export File
Transfer the For Docker installation:
ralph2.zip file to your Ralph 3 server.For Ubuntu installation: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.Verify Import
After import completes:
- Log into Ralph 3 web interface
- Verify that your data appears correctly
- Check record counts match expectations
- Test key workflows and reports
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:GUI Import
The graphical import interface is currently under development. Use CLI import for now.
- Visual file upload interface
- Field mapping tools
- Import preview and validation
- Progress tracking
- Error reporting
Import Best Practices
Test Before Production Import
Test Before Production Import
Always test imports on a staging environment:
- Set up a test Ralph instance
- Import your data
- Verify results
- Document any issues or required adjustments
- Only then import to production
Validate Data Before Import
Validate Data Before Import
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
Use Dry Run Mode
Use Dry Run Mode
Test imports without making changes:Review the output to identify potential issues.
Import in Logical Order
Import in Logical Order
When importing related data:
- Import parent/reference tables first (e.g., Manufacturers, Models)
- Then import dependent tables (e.g., Assets)
- Finally import relationships (e.g., Licenses, Assignments)
Keep Backup of Import Files
Keep Backup of Import Files
Maintain copies of:
- Original export files
- Modified/cleaned CSV files
- Import logs and error messages
- Database backups before import
Troubleshooting
Common Import Errors
Foreign key constraint errors
Foreign key constraint errors
Problem: Referenced objects don’t existSolution: Import parent tables before child tables, or update foreign key values to match existing records
Duplicate key errors
Duplicate key errors
Problem: Records with same unique identifier already existSolution: Use
--skipid flag to generate new IDs, or --update to update existing recordsMissing required field errors
Missing required field errors
Problem: CSV missing required columnsSolution: Add missing columns to CSV or provide default values
Encoding errors
Encoding errors
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:Export Data from Ralph 3
You can also export data from Ralph 3 for backup or transfer:Next Steps
After successful data import:- Verify data integrity - Check that all records imported correctly
- Set up permissions - Configure user access and roles
- Configure workflows - Set up asset lifecycle transitions
- Train users - Familiarize your team with Ralph 3
- Monitor performance - Watch for any issues with imported data
Configuration Guide
Configure LDAP, caching, and other advanced features