A robust, interactive tool for migrating Open WebUI databases from SQLite to PostgreSQL
Project description
Open WebUI PostgreSQL Migration Tool 🚀
A robust, interactive tool for migrating Open WebUI databases from SQLite to PostgreSQL. Designed for reliability and ease of use.
Preview
Migration Demo
https://github.com/user-attachments/assets/5ea8ed51-cc2d-49f0-9f1a-36e2f4e04f30
✨ Features
- 🖥️ Interactive command-line interface with clear prompts
- 🔍 Comprehensive database integrity checking
- 📦 Configurable batch processing for optimal performance
- ⚡ Real-time progress visualization
- 🛡️ Robust error handling and recovery
- 🔄 Unicode and special character support
- 🎯 Automatic table structure conversion
🚀 Quick Start
Easy Installation with uvx (Recommended)
Run directly without installation:
uvx open-webui-postgres-migration
Manual Installation
-
Clone the repository:
git clone https://github.com/taylorwilsdon/open-webui-postgres-migration.git cd open-webui-postgres-migration
-
Set up environment:
python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate pip install -r requirements.txt
-
Run the migration:
python migrate.py
📝 Best Practices
-
Before Migration:
- Backup your SQLite database
- CRITICAL: Set up PostgreSQL database and tables FIRST
- Set the
DATABASE_URLenvironment variable:DATABASE_URL="postgresql://user:password@host:port/dbname" export DATABASE_URL="postgresql://user:password@host:port/dbname"for macOS / Linuxset DATABASE_URL="postgresql://user:password@host:port/dbname"for windows- Start Open WebUI with the PostgreSQL
DATABASE_URLconfigured to create the database tables - Stop Open WebUI after confirming tables are created
- The migration script will verify this step was completed before proceeding
- Set the
- Verify PostgreSQL server access from host running script
- Check available disk space
-
During Migration:
- Don't interrupt the process
- Monitor system resources
- Keep network connection stable
-
After Migration:
- Verify data integrity
- Test application functionality
- Keep SQLite backup until verified
🔧 Configuration Options
During the migration, you'll be prompted to configure:
-
SQLite Database
- Path to your existing SQLite database
- Automatic validation and integrity checking
-
PostgreSQL Connection
- Host and port
- Database name
- Username and password
- Connection testing before proceeding
-
Performance Settings
- Batch size (100-5000 recommended)
- Automatic memory usage warnings
⚙️ System Requirements
- Python 3.8+
- PostgreSQL server (running and accessible)
- Sufficient disk space for both databases
- Network access to PostgreSQL server
🛡️ Safety Features
- ✅ Pre-migration database integrity verification
- ✅ Transaction-based processing
- ✅ Automatic error recovery
- ✅ Failed row tracking and reporting
- ✅ Progress preservation on interruption
🚨 Troubleshooting
Common issues and solutions:
| Issue | Solution |
|---|---|
| Connection Failed | Check PostgreSQL credentials and firewall settings |
| Permission Denied | Verify PostgreSQL user privileges |
| Memory Errors | Reduce batch size in configuration |
| Encoding Issues | Ensure proper database character encoding |
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
💬 Support
If you encounter issues:
- Check the troubleshooting section above
- Search existing GitHub issues
- Create a new issue with:
- Error messages
- Database versions
- System information
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file open_webui_postgres_migration-1.0.2.tar.gz.
File metadata
- Download URL: open_webui_postgres_migration-1.0.2.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95e030807b3c34b326cc7752742d7f0286d3dfd715bbc130e404da0296234845
|
|
| MD5 |
8904e6a13db7799dcb89895b9ac8cc50
|
|
| BLAKE2b-256 |
0f61d2a4bb7fbc44194a0eba5339b9f2a5f054403ae01bfe3d8b35b35429ad58
|
File details
Details for the file open_webui_postgres_migration-1.0.2-py3-none-any.whl.
File metadata
- Download URL: open_webui_postgres_migration-1.0.2-py3-none-any.whl
- Upload date:
- Size: 26.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a824aed4ab1ae1fda7fa63f78fc189cfe876ab777153e33b64d0f277a3c0f53b
|
|
| MD5 |
d5a8ae823f3a3f890b4fd54cdc15b161
|
|
| BLAKE2b-256 |
fd2bf971391978e97b683afe814e90b98c801e21618d993ef7dd9e4289ac843d
|