RethinkPort 🚢
A comprehensive tool for migrating RethinkDB databases to MySQL, designed to work with official RethinkDB dump files.
Port your RethinkDB data to MySQL.
Overview
This tool was created to address the lack of reliable migration tools for moving from RethinkDB to MySQL. It handles the complete migration pipeline including:
- Schema inference and optimization
- Data type conversion (including RethinkDB-specific types)
- Index and constraint migration
- Foreign key dependency management
- Batch processing for large datasets
Features
- ✅ Official RethinkDB dump support - Works with
rethinkdb dumpoutput - ✅ Smart schema inference - Analyzes data to create optimal MySQL schemas
- ✅ Data type conversion - Handles RethinkDB TIME objects, JSON, arrays
- ✅ Index migration - Preserves indexes and primary keys from .info files
- ✅ Dependency management - Processes tables in correct order for foreign keys
- ✅ Batch processing - Efficient handling of large datasets
- ✅ Progress tracking - Real-time migration statistics
- ✅ Error handling - Comprehensive logging and error reporting
Installation
Prerequisites
- Python 3.9+
- MySQL 5.7+ or MariaDB 10.2+
- RethinkDB (for creating dumps)
Install from PyPI
pip install rethinkport
Install from Source
git clone https://github.com/aoamusat/rethinkport.git
cd rethinkport
pip install -e .
Usage
Step 1: Create RethinkDB Dump
First, create a dump of your RethinkDB database:
rethinkdb dump -c <host:port> -f my_database_dump.tar.gz
Step 2: Extract the Dump
tar -xzf my_database_dump.tar.gz
This creates a directory structure like:
rethinkdb_dump_<date>/
└── <database_name>/
├── Table1.info
├── Table1.json
├── Table2.info
├── Table2.json
└── ...
Step 3: Run the Migration
Basic Usage
rethinkport /path/to/rethinkdb_dump_<date>/<database_name>/
With Configuration File
rethinkport /path/to/dump/ --config config.json
Command Line Options
rethinkport --help
usage: rethinkport [-h] [--config CONFIG] [--host HOST] [--port PORT]
[--user USER] [--password PASSWORD] [--database DATABASE]
[--dry-run] [--batch-size BATCH_SIZE] [--table-order TABLE_ORDER]
dump_path
RethinkPort 🚢 - Port your RethinkDB data to MySQL
positional arguments:
dump_path Path to extracted RethinkDB dump directory
optional arguments:
-h, --help show this help message and exit
--config CONFIG Configuration file path
--host HOST MySQL host (default: localhost)
--port PORT MySQL port (default: 3306)
--user USER MySQL username (default: root)
--password PASSWORD MySQL password
--database DATABASE MySQL database name
--dry-run Show what would be migrated without executing
--batch-size BATCH_SIZE
Batch size for data insertion (default: 1000)
--table-order TABLE_ORDER
Custom table processing order (JSON file)
Configuration
Environment Variables
export MYSQL_HOST=localhost
export MYSQL_PORT=3306
export MYSQL_USER=root
export MYSQL_PASSWORD=your_password
export MYSQL_DATABASE=your_database
Configuration File
Create a config.json file:
{
"mysql": {
"host": "localhost",
"port": 3306,
"user": "root",
"password": "your_password",
"database": "your_database",
"charset": "utf8mb4"
},
"migration": {
"batch_size": 1000,
"table_order": [
"Users",
"Products",
"Orders"
]
}
}
Data Type Mapping
| RethinkDB Type | MySQL Type | Notes |
|---|---|---|
| String (short) | VARCHAR(255) | Auto-sized based on data |
| String (long) | TEXT | For strings > 2000 chars |
| Number (int) | INT/BIGINT | Based on value range |
| Number (float) | DECIMAL(15,4) | Preserves precision |
| Boolean | BOOLEAN | Direct mapping |
| Object | JSON | RethinkDB objects → MySQL JSON |
| Array | JSON | RethinkDB arrays → MySQL JSON |
| TIME | DATETIME | Converts epoch_time to MySQL datetime |
| UUID | VARCHAR(255) | For primary/foreign keys |
Examples
Basic Migration
# Dump RethinkDB
rethinkdb dump -c localhost:28015 -f myapp_dump.tar.gz
# Extract
tar -xzf myapp_dump.tar.gz
# Migrate
rethinkport rethinkdb_dump_2024_01_15/myapp/
Advanced Migration with Custom Configuration
rethinkport \
rethinkdb_dump_2024_01_15/myapp/ \
--config production_config.json \
--batch-size 5000 \
--dry-run
Troubleshooting
Common Issues
-
Connection Errors
Error: Failed to connect to MySQL- Check MySQL credentials and connection
- Ensure MySQL server is running
- Verify database exists
-
Large Dataset Timeouts
Error: MySQL server has gone away- Increase
max_allowed_packetin MySQL - Reduce
--batch-size - Check MySQL timeout settings
- Increase
-
Schema Conflicts
Error: Table already exists- Tool drops existing tables by default
- Check MySQL user permissions
- Verify database name
Performance Tips
- Use SSD storage for better I/O performance
- Increase MySQL
innodb_buffer_pool_size - Adjust
--batch-sizebased on available memory - Run migration during low-traffic periods
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development Setup
git clone https://github.com/aoamusat/rethinkport.git
cd rethinkport
pip install -e ".[dev]"
pytest
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Built to solve real-world RethinkDB migration challenges
- Inspired by the need for reliable database migration tools
- Thanks to the RethinkDB and MySQL communities
Support
If you encounter issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Include your RethinkDB/MySQL versions and error logs
Note: This tool was created because existing migration solutions were insufficient for complex RethinkDB to MySQL migrations. It's designed to handle real-world scenarios with large datasets, complex schemas, and foreign key relationships.
Metadata
Release files for rethinkport 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rethinkport-1.0.3.tar.gz | 20.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rethinkport-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.9 kB
Release files / rethinkport-1.0.3.tar.gz
| Download URL | rethinkport-1.0.3.tar.gz |
|---|---|
| Size | 20.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fa4a61ddef1bcecb0534d07acf0b223dfc59decb812b6bcd53d04cb8fb905044
|
|
BLAKE2b-256 checksum How to use checksums |
b2bdc5e3863432d9e771abfdfaf6deb12b1da7b8db251d39df8cdce9dc11530c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 28, 2025.
Transparency logRelease files / rethinkport-1.0.3-py3-none-any.whl
| Download URL | rethinkport-1.0.3-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
34b881b376381ea1bea2027e3db78245ec469c2b5ad2b0e93ef5c80cb496bad5
|
|
BLAKE2b-256 checksum How to use checksums |
b4691617fd0c92bb2a1d7cd44fe8b746d8b4909f827b9506b490304f3b6c322a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 28, 2025.
Transparency log