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.3.tar.gz
.
File metadata
- Download URL: sql_compare-0.1.3.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94262d7fd370d517b1efdc532f32979f38b6db5f339c7be0aedbbce4659185e6 |
|
MD5 | aecd6d6923f7c22cd0581c144206e92e |
|
BLAKE2b-256 | 3a28f76870acf79fcc7e0680a8d4d2c61667926d92cc5a9566df8509e6eb4572 |
File details
Details for the file sql_compare-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: sql_compare-0.1.3-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89b1b40f291b7f40fd0ef8c8453b936111bf5eeeb7f18ca00c608ef9468d8d23 |
|
MD5 | 79e3a26090bd666fd9eacd23c0b8a122 |
|
BLAKE2b-256 | a8ab8d032b2ec03187ebd90c07bc7b60591e66d1ae7a1799bf0dc8fe8828f90c |