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

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
File Size Uploaded
sql_compare-0.tar.gz 8.3 kB Details

Built distribution (wheel)

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

Total release size: 16.7 kB

Release files / sql_compare-0.tar.gz

Download URL sql_compare-0.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
431b912f78136c753889a4b142c9d3c7da53d0463afa56b174fa8cc721d1585c
BLAKE2b-256 checksum
How to use checksums
f2ef9fc30f378be3989d7c81d7b50fd14baae0619d20f2cff14f8bb3830a1da3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Mar 7, 2025.

Transparency log

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

Download URL sql_compare-0-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1924e1191a49137c2075bcc837e31c5eefadfff555cc67ec2780504888136ec
BLAKE2b-256 checksum
How to use checksums
aacacc0c75b77778cd7795d3300366324e9b0a0e09201463f8d48e0729b62e9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Mar 7, 2025.

Transparency log

Release history Release notifications | RSS feed

0.3.0

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

This release

0 This release

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