Skip to content

Repository files navigation

data-diff -- Efficiently diff rows across databases

Community MaintainedLicense: MITPyPI

Note: This project is maintained by the community after Datafold sunset the project in May 2024.

data-diff is an open-source CLI and Python library for efficiently comparing data across 13+ database engines. It uses bisection and checksumming to find differing rows without transferring entire tables, making it fast even on tables with millions of rows.

Installation

pip install data-diff

Install with database-specific extras:

pip install 'data-diff[postgresql,mysql]'

Quick Start

CLI

data-diff \
postgresql://user:password@localhost/db1 table1 \
postgresql://user:password@localhost/db2 table2 \
--key-columns id \
--columns name,email,updated_at

Python API

importdata_diffdiff=data_diff.diff_tables(
table1=data_diff.connect_to_table("postgresql://localhost/db1", "table1", "id"),
table2=data_diff.connect_to_table("postgresql://localhost/db2", "table2", "id"),
)
forsign, rowindiff:
print(sign, row) # '+' for added, '-' for removed

Supported Databases

DatabaseStatus
PostgreSQLSupported
MySQLSupported
SnowflakeSupported
BigQuerySupported
DatabricksSupported
RedshiftSupported
DuckDBSupported
PrestoSupported
TrinoSupported
OracleSupported
MS SQLSupported
ClickHouseSupported
VerticaSupported

dbt Integration

data-diff integrates with dbt to compare tables between development and production environments:

data-diff --dbt

Install with dbt support:

pip install 'data-diff[dbt]'

See the full documentation for configuration details.

Documentation

Contributors

License

This project is licensed under the terms of the MIT License.

About

Compare tables within or across databases

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages