A Streamlit-based web application that simplifies the transfer of data from Microsoft Access databases (.mdb files) to PostgreSQL databases. Features a user-friendly interface with progress tracking, error reporting, and intelligent duplicate detection.
- π Web-based interface - No command-line expertise required
- π Drag & drop - Simple file upload for .mdb files
- π Auto-detection - Automatically discovers and transfers all tables
- π Progress tracking - Visual feedback for each table being processed
- π‘οΈ Duplicate prevention - Smart ID-based checking to avoid duplicate records
- π Detailed logging - Comprehensive error reporting and transfer statistics
- π³ Docker support - Easy deployment with Docker and Docker Compose
- π¨ Modern UI - Dark mode interface for comfortable viewing
- π Secure - Credentials managed via Streamlit secrets
- Prerequisites
- Installation
- Configuration
- Usage
- Docker Deployment
- Project Structure
- How It Works
- Troubleshooting
- Contributing
- License
- Python: 3.10 or higher
- PostgreSQL: 9.x or higher
- MDBTools: Required for reading Access databases
- Docker (optional): For containerized deployment
Ubuntu/Debian:
sudo apt-get update
sudo apt-get install mdbtoolsCentOS/RHEL/Fedora:
sudo dnf install mdbtoolsmacOS:
brew install mdbtoolsWindows: MDBTools can be installed via Windows Subsystem for Linux (WSL) or using a Docker container.
-
Clone the repository
git clone https://github.com/barisariburnu/mdb-to-postgresql.git cd mdb-to-postgresql -
Create a virtual environment (recommended)
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Clone the repository
git clone https://github.com/barisariburnu/mdb-to-postgresql.git cd mdb-to-postgresql -
Install Docker and Docker Compose
Follow the official Docker installation guide for your platform:
-
Create the
.streamlitdirectory (if not exists)mkdir -p .streamlit
-
Copy the example secrets file
cp .streamlit/secrets.toml.example .streamlit/secrets.toml
-
Edit
.streamlit/secrets.tomlwith your PostgreSQL credentials[postgres] user = "your_postgresql_username" password = "your_postgresql_password" host = "your_postgresql_host" # e.g., "localhost" or "192.168.1.100" port = "5432" database = "your_database_name" [app] max_file_size = 1073741824 # 1GB in bytes upload_folder = "uploads" # Temporary file storage directory
If deploying on a Linux server, you may need to open port 8501:
# Install firewalld (if not installed)
sudo dnf install firewalld -y
# Start and enable firewall
sudo systemctl start firewalld
sudo systemctl enable firewalld
# Open port 8501 for Streamlit
sudo firewall-cmd --permanent --add-port=8501/tcp
sudo firewall-cmd --reload
# Verify
sudo firewall-cmd --list-ports-
Activate your virtual environment (if using one)
source venv/bin/activate # On Windows: venv\Scripts\activate
-
Start the Streamlit application
streamlit run app.py
-
Open your browser and navigate to
http://localhost:8501 -
Upload your .mdb file and click "Start Transfer"
-
Build and start the container
docker-compose up -d --build
-
Access the application at
http://your-server-ip:8501 -
View logs (optional)
docker-compose logs -f
-
Stop the application
docker-compose down
# Build and start in detached mode
docker-compose up -d --build
# View real-time logs
docker-compose logs -f
# Stop the application
docker-compose down
# Restart the application
docker-compose restart
# Remove containers and volumes
docker-compose down -vmdb-to-postgresql/
βββ .streamlit/
β βββ config.toml # Streamlit UI configuration
β βββ secrets.toml # Database credentials (not in repo)
β βββ secrets.toml.example # Example secrets template
βββ app.py # Main application file
βββ config.py # Configuration management
βββ requirements.txt # Python dependencies
βββ Dockerfile # Docker container definition
βββ docker-compose.yml # Docker Compose configuration
βββ .gitignore # Git ignore rules
βββ README.md # This file
βββ LICENSE # MIT License
βββ CONTRIBUTING.md # Contribution guidelines
βββ CHANGELOG.md # Version history
βββ uploads/ # Temporary upload directory (auto-created)
- Upload: User uploads an .mdb file through the web interface
- Validation: Application validates file size and format
- Connection Test: Verifies PostgreSQL connection
- Table Discovery: Uses MDBTools to detect all tables in the Access database
- Data Extraction: Each table is exported to CSV format temporarily
- Duplicate Check: If tables contain an 'ID' column, existing records are filtered
- Data Transfer: Clean data is inserted into PostgreSQL
- Progress Tracking: Real-time updates shown for each table
- Cleanup: Temporary files are automatically removed
- Results: Detailed summary displayed with success/error status per table
Problem: "PostgreSQL Connection Error"
Solutions:
- Verify PostgreSQL server is running
- Check firewall settings (port 5432 should be open)
- Verify credentials in
.streamlit/secrets.toml - Ensure user has appropriate database permissions
- Test connection manually:
psql -h your_host -U your_user -d your_database
Problem: "MDBTools not installed"
Solutions:
- Install MDBTools (see Prerequisites)
- Verify installation:
mdb-tables --version
- If using Docker, rebuild the container:
docker-compose up -d --build
Problem: "File size exceeds maximum limit"
Solutions:
- Current limit is 1GB (defined in
secrets.toml) - Increase
max_file_sizein.streamlit/secrets.toml - Ensure sufficient disk space in upload directory
Problem: "Address already in use"
Solutions:
- Stop other Streamlit instances
- Change port in docker-compose.yml:
ports: - "8502:8501" # Use port 8502 instead
Contributions are welcome! Please read our Contributing Guidelines for details on:
- Code of conduct
- Development setup
- Submitting pull requests
- Reporting bugs
- Suggesting enhancements
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Commit your changes (
git commit -m 'β¨ Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Streamlit
- Uses MDBTools for Access database reading
- Powered by SQLAlchemy and pandas
- π Bug Reports: GitHub Issues
- π‘ Feature Requests: GitHub Issues
- π Documentation: GitHub Wiki
Made with β€οΈ by Baris Ari Burnu
If this project helped you, please consider giving it a β on GitHub!