Skip to main content

Compare SQL schemas

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sql_compare-0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sql_compare-0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file sql_compare-0.tar.gz.

File metadata

  • Download URL: sql_compare-0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sql_compare-0.tar.gz
Algorithm Hash digest
SHA256 431b912f78136c753889a4b142c9d3c7da53d0463afa56b174fa8cc721d1585c
MD5 4ddd6cb8d4b4ce2315cb38b28e0cb269
BLAKE2b-256 f2ef9fc30f378be3989d7c81d7b50fd14baae0619d20f2cff14f8bb3830a1da3

See more details on using hashes here.

Provenance

The following attestation bundles were made for sql_compare-0.tar.gz:

Publisher: release.yml on Mergifyio/sql-compare

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sql_compare-0-py3-none-any.whl.

File metadata

  • Download URL: sql_compare-0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sql_compare-0-py3-none-any.whl
Algorithm Hash digest
SHA256 b1924e1191a49137c2075bcc837e31c5eefadfff555cc67ec2780504888136ec
MD5 d31700bcc3de9e3bcdd0c388099eaa0a
BLAKE2b-256 aacacc0c75b77778cd7795d3300366324e9b0a0e09201463f8d48e0729b62e9e

See more details on using hashes here.

Provenance

The following attestation bundles were made for sql_compare-0-py3-none-any.whl:

Publisher: release.yml on Mergifyio/sql-compare

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page