Tool for comparing and inspecting data in SQL databases.
Project description
SQLCompyre
SQLCompyre is a simple Python package that allows you to find and explore the differences between SQL tables, schemas, and entire databases. It provides both a Python interface and a CLI, allowing it to be used for both ad-hoc comparisons as well as in-depth analyses.
SQLCompyre is designed to be dialect-agnostic and should, thus, work with most database systems out-of-the-box.
Usage example
Given a connection to a database, this snippet will print a report of the differences between two tables:
import sqlalchemy as sa
import sqlcompyre as sc
engine = sa.create_engine("<your_connection_string>")
comparison = sc.compare_tables(engine, "<left table name>", "<right table name>")
report = comparison.summary_report()
print(report)
To find more examples and get started, please visit the documentation.
Installation
SQLCompyre can be installed via pip
or conda
:
pip install sqlcompyre
# or
micromamba install sqlcompyre
# or
conda install sqlcompyre
Details on its usage can be found in the documentation.
Development
This project is managed by pixi. You can install the package in development mode using:
git clone https://github.com/quantco/sqlcompyre
cd sqlcompyre
pixi run pre-commit-install
pixi run postinstall
Running Tests Locally
-
Make sure you have
msodbcsql18
installed, or install it here -
Make sure you have
Docker
installed, or install it here -
Create a local test database with the following command:
docker compose up
- Set environment variable
export DB_CONNECTION_STRING="mssql+pyodbc://sa:Passw0rd@localhost:1435/master?driver=ODBC+Driver+18+for+SQL+Server&Encrypt=no"
- Navigate to the main directory of this repository and run pytest.
pixi run test
Project details
Release history Release notifications | RSS feed
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 sqlcompyre-1.0.1.tar.gz
.
File metadata
- Download URL: sqlcompyre-1.0.1.tar.gz
- Upload date:
- Size: 113.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55320eb18aad4aa899665259af0ce498c92b92c9118f3fec01535e44b06392c3 |
|
MD5 | 39f2aaea46d8201c3bc4d56bc2620a48 |
|
BLAKE2b-256 | b45ae2c22e095568a8c0120bffbaec33671f44928941a57cc716cc772d6ea83b |
Provenance
The following attestation bundles were made for sqlcompyre-1.0.1.tar.gz
:
Publisher:
build.yml
on Quantco/sqlcompyre
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
sqlcompyre-1.0.1.tar.gz
- Subject digest:
55320eb18aad4aa899665259af0ce498c92b92c9118f3fec01535e44b06392c3
- Sigstore transparency entry: 147288330
- Sigstore integration time:
- Predicate type:
File details
Details for the file sqlcompyre-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: sqlcompyre-1.0.1-py3-none-any.whl
- Upload date:
- Size: 39.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b4f5e3e7bb2ae04aa037a227259cde2d7ef70181644d8954b7378cc510438b8 |
|
MD5 | c195caabc2e792fad4fda7688a9060cd |
|
BLAKE2b-256 | adc9cf20270e7d964d9c697677e7d915db38b3167c9951bdb8cdc7e48392242d |
Provenance
The following attestation bundles were made for sqlcompyre-1.0.1-py3-none-any.whl
:
Publisher:
build.yml
on Quantco/sqlcompyre
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
sqlcompyre-1.0.1-py3-none-any.whl
- Subject digest:
6b4f5e3e7bb2ae04aa037a227259cde2d7ef70181644d8954b7378cc510438b8
- Sigstore transparency entry: 147288331
- Sigstore integration time:
- Predicate type: