Skip to main content

A CLI tool to convert PostgreSQL/MySQL databases to SQLite

Project description

DbConvert

Python SQLAlchemy Typer License: MIT

Convert your PostgreSQL or MySQL database to an SQLite file with ease.

Features

  • Convert PostgreSQL databases to SQLite
  • Convert MySQL databases to SQLite
  • Command-line interface for easy usage
  • Preserves table structures and data
  • Supports all common data types
  • Rich progress display and error reporting

Installation

You can install DbConvert using pip:

pip install dbconvert

Requirements

  • Python 3.8 or higher
  • PostgreSQL or MySQL database to convert from

Usage

Command Line Options

dbconvert [COMMAND] [OPTIONS]

Commands:
  convert              Convert a database to SQLite
  supported-databases  Show supported database types

Options for convert:
  --source TEXT    Source database type (postgresql, mysql)  [required]
  --conn TEXT      Source database connection string         [required]
  --sqlite TEXT    Target SQLite database file path         [required]
  --help          Show this help message and exit

Connection String Format

PostgreSQL

postgresql://[user[:password]@][host][:port][/dbname]

MySQL

mysql://[user[:password]@][host][:port][/dbname]

Examples

  1. Convert a PostgreSQL database:
dbconvert convert --source postgresql --conn "postgresql://user:password@dbhost:5432/mydb" --sqlite mydb.sqlite
  1. Convert a MySQL database:
dbconvert convert --source mysql --conn "mysql://user:password@dbhost:3306/production" --sqlite prod_backup.sqlite
  1. List supported database types:
dbconvert supported-databases

Development

Setup Development Environment

  1. Clone the repository:
git clone https://github.com/ysskrishna/dbconvert.git
cd dbconvert
  1. Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install development dependencies:
pip install -e .

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

If you encounter any issues or have questions, please open an issue on GitHub.

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

dbconvert-1.0.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbconvert-1.0.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file dbconvert-1.0.0.tar.gz.

File metadata

  • Download URL: dbconvert-1.0.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.5

File hashes

Hashes for dbconvert-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7140674579cb24d64476ad951161917b02eb2923c5e2c63eab2126df037e9257
MD5 0a0ade7fd4fb01193ccb38cdffb7bee6
BLAKE2b-256 5b3606134da94edcef84305f591edc2cbd795f01c925ca3836ac7212fdc0c3e7

See more details on using hashes here.

File details

Details for the file dbconvert-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: dbconvert-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.5

File hashes

Hashes for dbconvert-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52ade048ee7a2335c08da5ce5e88d11c852a4160c86ebb97cce1d092d4c4f1e3
MD5 25dfe3862d96821c6706d6c9767599eb
BLAKE2b-256 9762c22562d2cecf472d5e312b04155fa3f683ea8b6f5fc6b7decd9bab445892

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page