Skip to main content

Compare SQL schemas

Project description

SQL Compare

Compare SQL schemas.

This package allows to compare two SQL files (or string) 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).

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.1.1.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

sql_compare-0.1.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sql_compare-0.1.1.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for sql_compare-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b341120b60c50e02142c4b1e2abb80cf9b63d3c64b89aaf7d7ce5d564234f477
MD5 36ce1060202b77792ce1ce49132beddb
BLAKE2b-256 2ed1d54452ad0172653a8253c8c4e6a8d808b6ce5b1097d1799d5bef5e3ca816

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sql_compare-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for sql_compare-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 43b53287e0683e7104e564d05cb5ccf2e8fe3ed60375ffab7633a5757d96db2c
MD5 a9625459b7183b1a5b4cf2e6f830c5b0
BLAKE2b-256 07cf88c31c74509c3229a60535fca505216b7a627bb1de792b43aff934c12574

See more details on using hashes here.

Supported by

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