Migrates Oracle dbs to PostgreSQL, MySQL and SQLite
Project description
CBL Migrator
A lightweight SQLAlchemy-based tool that migrates Oracle databases to MySQL, PostgreSQL, or SQLite. It is used in ChEMBL dump generation.
Usage in Python
from cbl_migrator import DbMigrator
origin = 'oracle://{user}:{pass}@{host}:{port}/?service_name={service_name}&encoding=utf8'
dest = 'postgresql://{user}:{pass}@{host}:{port}/{dbname}?client_encoding=utf8'
migrator = DbMigrator(origin, dest, ['excluded_table1', 'excluded_table2'], n_workers=4)
migrator.migrate()
Command Line Usage
cbl-migrator "oracle://{user}:{pass}@{host}:{port}/?service_name={service_name}&encoding=utf8" \
"postgresql://{user}:{pass}@{host}:{port}/{dbname}?client_encoding=utf8" \
--n_workers 8
How It Works
- Copies tables from the source, preserving only PKs initially.
- Migrates table data in parallel.
- If successful, applies constraints and then indexes; skips indexes already covered by unique keys.
- Logs objects that fail to migrate.
What It Does Not Do
- Avoids tables without PKs (may hang if a unique field is referenced by an FK).
- Ignores server default values, autoincrement fields, triggers, and procedures.
SQLite
- No concurrent writes or ALTER TABLE ADD CONSTRAINT.
- Uses one core and creates constraints at table creation time.
- Inserts rows sequentially in correct FK order.
MySQL
- Converts CLOBs to LONGTEXT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cbl_migrator-0.5.0.tar.gz
(10.0 kB
view details)
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 cbl_migrator-0.5.0.tar.gz.
File metadata
- Download URL: cbl_migrator-0.5.0.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a207c3e62c5b0aea327e2d2892c74c3d9ed54451a94a19ce9d135eae523fa93
|
|
| MD5 |
bab9ecff0b94ba2bb61009fb0da8904d
|
|
| BLAKE2b-256 |
ed97827f6389ebabd2438843a704c7190be8c2ae15419d7aaa53c00713ae346a
|
File details
Details for the file cbl_migrator-0.5.0-py3-none-any.whl.
File metadata
- Download URL: cbl_migrator-0.5.0-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fef1fbcafd3f2f764ffd1780c22ad06d58c5d9b5121b1b682213e9891d4b646
|
|
| MD5 |
0c3cc777edcc96afd2542caed21ba2fc
|
|
| BLAKE2b-256 |
c4784d896fe7dd0f4e1be8efbebf439a15be7f8916a40ff1d0fc882642bfdcd9
|