Skip to main content

CI Testing Latest Version Supported Python versions License: MIT

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.

Metadata

Release files for cbl-migrator 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cbl-migrator 0.5.0
File Size Uploaded
cbl_migrator-0.5.0.tar.gz 10.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cbl-migrator 0.5.0
File Interpreter ABI Platform
cbl_migrator-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.3 kB

Release files / cbl_migrator-0.5.0.tar.gz

Download URL cbl_migrator-0.5.0.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4a207c3e62c5b0aea327e2d2892c74c3d9ed54451a94a19ce9d135eae523fa93
BLAKE2b-256 checksum
How to use checksums
ed97827f6389ebabd2438843a704c7190be8c2ae15419d7aaa53c00713ae346a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.21

Release files / cbl_migrator-0.5.0-py3-none-any.whl

Download URL cbl_migrator-0.5.0-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2fef1fbcafd3f2f764ffd1780c22ad06d58c5d9b5121b1b682213e9891d4b646
BLAKE2b-256 checksum
How to use checksums
c4784d896fe7dd0f4e1be8efbebf439a15be7f8916a40ff1d0fc882642bfdcd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.21

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.0

2 release files

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page