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
Built Distribution
File details
Details for the file sql_compare-0.1.0.tar.gz
.
File metadata
- Download URL: sql_compare-0.1.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.3 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cea0879642f86bbef8050b7217365c09f3cfa03b139a2d781d4663842e71f44 |
|
MD5 | e775b5211416e582f9e4d31206fd39f2 |
|
BLAKE2b-256 | 7e4a57169d03689de884346160bdffb1f6413ad5b88ebc812ed328efc479a763 |
File details
Details for the file sql_compare-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: sql_compare-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.3 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c8fac499721a20cde193b8929aa4358bcd9aa8b971b3f4e2692046e99a8f3cf |
|
MD5 | eac20ed2c87c3a974aba88a1e98cc37e |
|
BLAKE2b-256 | 700567e5af6ddaaaf9446f52b3f3040790bb620cf2e3285f8a650fec26eac6ea |