SQL Diff Explainer
Explain the meaningful structural differences between two SQL SELECT queries.
The package uses sqlglot behind an abstract
parser interface, so callers receive a stable result even if the parser
implementation changes. It reports changes to projections, joins, filters,
grouping, aggregation, ordering, pagination, and DISTINCT, with a static
low/medium/high risk classification.
The current patch release is 0.1.1. It includes the stable risk_level
compatibility property, semantic join-type pairing, and high-risk classification
for outer-to-inner join changes.
Development
This project uses a src/ layout and requires Python 3.10 or newer.
python -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install -e ".[dev]"
pytest
Library usage
from sql_diff_explainer import explain_sql_change
result = explain_sql_change(
"SELECT department, COUNT(*) FROM employees GROUP BY department",
"SELECT department, COUNT(*) FROM employees WHERE active = TRUE GROUP BY department",
)
print(result.to_dict())
explain_sql_change raises SQLParseError for invalid SQL and UnsupportedSQL
for non-SELECT statements. Pass dialect="postgres" (or another sqlglot
dialect) when parsing dialect-specific syntax.
CLI
sql-diff-explainer before.sql after.sql
sql-diff-explainer before.sql after.sql --dialect postgres --format json
JSON output is intended for CI and integrations; text output is optimized for human review. The process exits with status 2 for unreadable files or expected SQL errors.
Metadata
Release files for sql-diff-explainer 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sql_diff_explainer-0.1.1.tar.gz | 7.7 kB | Without provenance | Details for sql_diff_explainer-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sql_diff_explainer-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for sql_diff_explainer-0.1.1-py3-none-any.whl |
Total release size: 15.6 kB
Release files / sql_diff_explainer-0.1.1.tar.gz
| Download URL | sql_diff_explainer-0.1.1.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
943e8b2dfa105801045fb3ae5c26cc60e7e2e7a5a65b9f1f2b63b79ac8dbe45d
|
|
BLAKE2b-256 checksum How to use checksums |
b71c71842ba042a601d1ea93fe4de1605db4548539da3df5e45394154b5feec9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / sql_diff_explainer-0.1.1-py3-none-any.whl
| Download URL | sql_diff_explainer-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
efb5d00be7e37526985300da6d961bce7b825b1ec3c752a5f04849649efdb055
|
|
BLAKE2b-256 checksum How to use checksums |
13446f2c01e4ebf401dc63d956b7121970e97cdd5ef15957a2ed64d8f69f1386
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for sql-diff-explainer 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.