Skip to main content

SQL Compare

Compare SQL schemas.

This package allows to compare two SQL files (or strings) to know whether their statements are the same or not. The comparison doesn't care about the order of the columns in a table or the order of the values in an enumerator. It also excludes irrelevant data like comments.

Its main usage is to compare the schemas of two databases (e.g. staging and production). See this blog post that tells about the creation of the package.

Installation

$ pip install sql-compare

Usage

Compare two SQL schemas using strings.

import sql_compare

assert sql_compare.compare(first_schema, second_schema)

Compare two SQL schemas using files.

import pathlib
import sql_compare

first_schema = pathlib.Path("/path/to/schema.sql")
second_schema = pathlib.Path("/path/to/other/schema.sql")

assert sql_compare.compare_files(first_schema, second_schema)

Dependencies

SQL Compare relies on sqlparse to parse SQL statements.

Metadata

Release files for sql-compare 0.3.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 sql-compare 0.3.0
File Size Uploaded
sql_compare-0.3.0.tar.gz 9.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sql-compare 0.3.0
File Interpreter ABI Platform
sql_compare-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.3 kB

Release files / sql_compare-0.3.0.tar.gz

Download URL sql_compare-0.3.0.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
deefbcdad9ef375f1177bceb89efe38c917fe22caf09cd392a74d7a8cceffd59
BLAKE2b-256 checksum
How to use checksums
a4af3576e82e046595fcd88b19ea4b529aa72e223d012b868df28cf9fd0bf7d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.

Transparency log

Release files / sql_compare-0.3.0-py3-none-any.whl

Download URL sql_compare-0.3.0-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
88aa145ab8a3b9b5ad9cc3168e9a2cda4120510509ce4f8d42f5619b87f15b49
BLAKE2b-256 checksum
How to use checksums
5f3c3027c9b9fef519dbff58a1e055916580d4c7dd19945ac905a35738c023a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0

2 release files

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