Registry / data / sql-compare

sql-compare

JSON →
library0.2.0pypypi✓ verified 83d ago

Compare SQL schemas and generate human-readable diffs. Version 0.2.0, released November 2024. Active development, monthly releases.

pip install sql-compare
INSTALL
IMPORT
SIG · SQL-COMPARE
S
sql-compare
datapythonv0.2.0
Install
1.6s avg
Import
58ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.062s · 18.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.054s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

diff
from sql_compare import diff
from sqlcompare import diff
Package uses underscore in module name.
diff_files
from sql_compare import diff_files
from sql_compare.diff import diff_files
Functions are at package level, not submodule.

Basic usage: compare two SQL schema strings and print the diff.

from sql_compare import diff schema1 = "CREATE TABLE users (id INT, name TEXT);" schema2 = "CREATE TABLE users (id INT, name VARCHAR(255));" print(diff(schema1, schema2))
sql-compare --version
Debug
Known issues
breakingIn version 0.2.0, the return type of `diff()` changed from a string to a list of change objects. Code expecting a string will break.
fix
Use `get_diff()` for human-readable string output, or iterate over the list objects returned by `diff()`.
affects: >=0.2.0
deprecatedThe function `get_diff()` is deprecated in 0.2.0; use `diff()` or `diff_files()` instead.
fix
Replace `get_diff(a, b)` with `str(diff(a, b))` or similar.
affects: >=0.2.0
gotcha`diff_files()` expects file paths, not file objects. Passing an open file handle will fail.
fix
Always pass string paths: `diff_files('schema1.sql', 'schema2.sql')`.
affects: >=0.1.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'sql_compare'
The package is installed as 'sql-compare' but import uses underscore.
fix
Install with `pip install sql-compare` and import with `from sql_compare import diff`.
AttributeError: module 'sql_compare' has no attribute 'get_diff'
Function renamed or removed in newer version.
fix
Use `diff()` or `diff_files()` instead of `get_diff()`.
TypeError: expected str, bytes or os.PathLike object, not _io.TextIOWrapper
Passed a file object to `diff_files()` instead of a file path.
fix
Pass a string file path: `diff_files('file1.sql', 'file2.sql')`.
Upgrade
Version history
0.2.0latest on PyPI · released Feb 12, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
sql-compare — pip install sql-compare · libregistry