The goal of this project is to implement a script in Python to migrate data from SQLite to PostgreSQL. The data includes information about movies, people, and genres. The code utilizes data classes, context managers for establishing and closing connections, and handles read and write errors. Pytest is used to check data integrity between tables in both databases.
Python
SQLite
PostgreSQL
PyTest
Pydantic
Docker
Clone the repository and navigate to the /infra
directory:
git clone https://github.com/temirovazat/sqlite-to-postgres.git
cd sqlite-to-postgres/infra/
Create a .env
file and add project settings:
nano .env
# PostgreSQL
POSTGRES_DB=cinemax_database
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
# SQLite
SQLITE_PATH=/opt/sqilte_to_postgres/db.sqlite
Deploy and run the project in containers:
docker-compose up
Along with PostgreSQL, the associated admin panel pgAdmin is launched at:
http://127.0.0.1:5050