Detect mismatched column types & correct them in your database using SQLAlchemy .
Project description
🧠 dbtype_checker
A simple and lightweight tool to detect columns stored in the wrong data type in your database.
It connects to your SQL database, samples data, and infers the true data types using intelligent pandas-based logic.
🚀 Features
- ✅ Detects
int,float,bool,datetime, andstr - ✅ Identifies type mismatches based on actual data values (not just schema)
- ✅ Supports MySQL, PostgreSQL, and (optionally) Oracle
- ✅ Can auto-fix mismatched columns (via
ALTER TABLE) - ✅ Safe conversions with pre-cleaning (e.g., "true"/"false" to boolean)
- ✅ No LLMs or external APIs — pure pandas + regex logic
📦 Installation
Install via pip:
pip install dbtype_checker " OR" pip install dbtype-checker==0.1.10
"""
## EXAMPLE USAGE
For postgres:
from dbtype_checker.checker import run_type_check_and_fix
# Detection
run_type_check_and_fix("postgresql+pg8000://user:password@localhost/database_name"dry_run=True)
# Correction
run_type_check_and_fix("postgresql+pg8000://user:password@localhost/database_name"dry_run=False)
For MySQL:
from dbtype_checker.checker import run_type_check_and_fix
# Detection
run_type_check_and_fix("mysql+pymysql://user:password@localhost:port/database", dry_run=True)
# Correction
run_type_check_and_fix("mysql+pymysql://user:password@localhost:port/database", dry_run=False)
For Oracle:
from dbtype_checker.checker import run_type_check_and_fix
db_url = "oracle+cx_oracle://username:password@host:1521/?service_name=your_service_name"
# Detection
run_type_check_and_fix(db_url, dry_run=True)
#Correction
run_type_check_and_fix(db_url,dry_run=False)
For CLI:
# Detection
python -m dbtype_checker.checker --db_url "postgresql+pg8000://user:password@localhost/dbname" --dry_run true
#Correction
python -m dbtype_checker.checker --db_url "mysql+pymysql://user:password@localhost/dbname" --dry_run false
"""
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
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 dbtype_checker-0.1.12.tar.gz.
File metadata
- Download URL: dbtype_checker-0.1.12.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
170810b33adf8ec8723b86b5c2f3c1289d841bcfba0b59d841dc00ee576e5d04
|
|
| MD5 |
4d6e810cf0f487d072ac958768876e04
|
|
| BLAKE2b-256 |
6c7f896986c8485fca18b49042cf5b79e706f3d0c4f6bd636e23a143c93f792e
|
File details
Details for the file dbtype_checker-0.1.12-py3-none-any.whl.
File metadata
- Download URL: dbtype_checker-0.1.12-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81c2b07334ada7d8abf9407cc46cbde73028caf600d6af113535926ce6e046d0
|
|
| MD5 |
b1a8b9193bfe97ae5e0e4e543c804a47
|
|
| BLAKE2b-256 |
4a2cb906e4ff08da9f7973f6b093345c70a363f727a8c7ebdeef6c69a66dae98
|