Overview
This migration tool bridges the gap between Kuzu and FalkorDB by:- Automatically discovering your Kuzu database schema
- Exporting all nodes and relationships to properly formatted CSV files
- Loading these CSV files into FalkorDB using the FalkorDB Rust loader
Features
- Automatic Schema Discovery: Dynamically discovers all node types and relationship types in your Kuzu database
- FalkorDB Compatibility: Generates CSV files in the exact format expected by FalkorDB
- Intelligent Label Mapping: Maps Kuzu relationship names to standardized FalkorDB edge types
- Complex Property Handling: Properly handles lists, nested values, and various data types
- Comprehensive Export: Exports both nodes and relationships with full metadata
- Schema Documentation: Optional JSON schema file generation for documentation purposes
Prerequisites
- Python 3.9+
kuzuPython package- FalkorDB instance (local, Docker, or Cloud)
- FalkorDB Rust Loader
Installation
- Install the required dependencies:
- Download the migration script:
Step 1: Exporting from Kuzu
Basic Usage
Export all data from a Kuzu database:Advanced Usage
Command Line Options
Output Structure
The export script generates the following files: Node CSV Files:- Format:
nodes_<NodeType>.csv - Structure:
id,labels,property1,property2,... - Example:
nodes_Application.csv,nodes_Machine.csv
- Format:
edges_<EdgeType>.csv - Structure:
source,source_label,target,target_label,type - Example:
edges_CONNECTS.csv,edges_CONTAINS.csv
- File:
schema.json - Contains: Export metadata, node types, relationship types, and file mappings
Example Export Output
Step 2: Loading into FalkorDB
Use the high-performance FalkorDB Rust Loader to load the exported CSV files directly into FalkorDB.Installation
target/release/falkordb-loader.
Basic Usage
After exporting your Kuzu database to CSV files, load them into FalkorDB:- Connect to FalkorDB (localhost:6379 by default)
- Create the graph
my_graph - Load all CSV files from the
csv_outputdirectory - Create indexes and constraints automatically
Advanced Usage
For more control over the loading process:Command-Line Options
Performance Features
The Rust loader provides significant advantages for loading Kuzu exports:- Async Operations: All database operations use async/await for better concurrency
- Batch Processing: Processes multiple records per query (default: 5000)
- Memory Efficient: Streams data from CSV files without loading everything into memory
- Progress Tracking: Real-time progress updates during loading
- Error Handling: Comprehensive error handling with detailed logging
Example Output
Performance Tips
- Match export and loader directories: If you used
--output my_csv_exportduring export, use--csv-dir my_csv_exportwhen loading - Adjust batch size: For very large datasets, you might want to increase batch size:
--batch-size 10000 - Monitor progress: Use
--progress-intervalto get regular updates - Enable verbose logging: Set
RUST_LOG=debugfor detailed information - Use stats: Add
--statsto see a summary of loaded data after completion
Data Mapping Features
Relationship Mapping
The script intelligently maps Kuzu relationship names to standardized FalkorDB edge types, ensuring consistent naming conventions.Label Enhancement
The script enhances node labels with context for better FalkorDB compatibility:- Process nodes in different contexts:
Application:Process,Service:Process, orOS:Process - Network zones:
Network:Zone - Service software:
Software:Service
Error Handling
The migration script includes robust error handling:- Validates database path exists
- Handles missing relationship types gracefully
- Continues export even if individual tables fail
- Provides detailed progress and error messages
Troubleshooting
Common Issues
- Database not found: Ensure the database path is correct and accessible
- Permission errors: Check write permissions for the output directory
- Memory issues: For very large databases, consider adjusting batch sizes or processing in chunks
Debug Mode
For additional debugging information, you can modify the script to include more verbose logging or add print statements to track the export process.Additional Resources
Next Steps
- Explore FalkorDB Cypher Language for querying your graph
- Learn about FalkorDB Operations for production deployments
- Check out FalkorDB Integration options
Frequently Asked Questions
Does the Kuzu migration tool require manual schema configuration?
Does the Kuzu migration tool require manual schema configuration?
No. The tool uses automatic schema discovery to dynamically detect all node types and relationship types in your Kuzu database. Optionally, generate a
schema.json for documentation.What is the recommended way to load exported CSV files into FalkorDB?
What is the recommended way to load exported CSV files into FalkorDB?
Use the FalkorDB Rust Loader for best performance. It supports async operations, batch processing (default 5000), and memory-efficient streaming.
How are Kuzu relationship names handled during migration?
How are Kuzu relationship names handled during migration?
The script intelligently maps Kuzu relationship names to standardized FalkorDB edge types. For example,
INSTANCE_APP_SW becomes INSTANCE as the edge type.Can I migrate a very large Kuzu database?
Can I migrate a very large Kuzu database?
Yes. Adjust the
--batch-size parameter (try 10000 for large datasets), use the Rust loader for performance, and monitor progress with --progress-interval. The streaming approach avoids loading everything into memory.What Python version is required for the Kuzu export script?
What Python version is required for the Kuzu export script?
Python 3.9 or higher is required, along with the
kuzu Python package. Install with pip3 install kuzu.