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.3.tar.gz (8.1 kB view hashes)

Uploaded Source

Built Distribution

sql_compare-0.1.3-py3-none-any.whl (8.2 kB view hashes)

Uploaded Python 3

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