Skip to main content

Tool for comparing and inspecting data in SQL databases.

Project description

SQLCompyre

CI conda-forge Documentation pypi-version python-version

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

  1. Make sure you have msodbcsql18 installed, or install it here

  2. Make sure you have Docker installed, or install it here

  3. Create a local test database with the following command:

docker compose up
  1. Set environment variable
export DB_CONNECTION_STRING="mssql+pyodbc://sa:Passw0rd@localhost:1435/master?driver=ODBC+Driver+18+for+SQL+Server&Encrypt=no"
  1. Navigate to the main directory of this repository and run pytest.
pixi run test

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

sqlcompyre-1.0.1.tar.gz (113.9 kB view details)

Uploaded Source

Built Distribution

sqlcompyre-1.0.1-py3-none-any.whl (39.5 kB view details)

Uploaded Python 3

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

Hashes for sqlcompyre-1.0.1.tar.gz
Algorithm Hash digest
SHA256 55320eb18aad4aa899665259af0ce498c92b92c9118f3fec01535e44b06392c3
MD5 39f2aaea46d8201c3bc4d56bc2620a48
BLAKE2b-256 b45ae2c22e095568a8c0120bffbaec33671f44928941a57cc716cc772d6ea83b

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqlcompyre-1.0.1.tar.gz:

Publisher: build.yml on Quantco/sqlcompyre

Attestations:

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

Hashes for sqlcompyre-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6b4f5e3e7bb2ae04aa037a227259cde2d7ef70181644d8954b7378cc510438b8
MD5 c195caabc2e792fad4fda7688a9060cd
BLAKE2b-256 adc9cf20270e7d964d9c697677e7d915db38b3167c9951bdb8cdc7e48392242d

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqlcompyre-1.0.1-py3-none-any.whl:

Publisher: build.yml on Quantco/sqlcompyre

Attestations:

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