Coder Social home page Coder Social logo

dave-connors-3 / data-diff Goto Github PK

View Code? Open in Web Editor NEW

This project forked from datafold/data-diff

0.0 0.0 0.0 1.93 MB

Compare tables within or across databases

Home Page: https://www.datafold.com/blog/open-source-data-diff

License: MIT License

Shell 0.36% Python 99.48% Dockerfile 0.15%

data-diff's Introduction

Datafold

data-diff

What is data-diff?

data-diff is a free, open-source tool that enables data professionals to detect differences in values between any two tables.

Documentation

๐Ÿ—Ž Documentation - our detailed documentation has everything you need to start diffing.

Databases we support

  • PostgreSQL >=10
  • MySQL
  • Snowflake
  • BigQuery
  • Redshift
  • Oracle
  • Presto
  • Databricks
  • Trino
  • Clickhouse
  • Vertica
  • DuckDB >=0.6
  • SQLite (coming soon)

For their corresponding connection strings, check out our detailed table.

Looking for a database not on the list?

If a database is not on the list, we'd still love to support it. Please open an issue to discuss it, or vote on existing requests to push them up our todo list.

Get started

Installation

First, install data-diff using pip.

pip install data-diff

Then, install one or more driver(s) specific to the database(s) you want to connect to.

  • pip install 'data-diff[mysql]'

  • pip install 'data-diff[postgresql]'

  • pip install 'data-diff[snowflake]'

  • pip install 'data-diff[presto]'

  • pip install 'data-diff[oracle]'

  • pip install 'data-diff[trino]'

  • pip install 'data-diff[clickhouse]'

  • pip install 'data-diff[vertica]'

  • For BigQuery, see: https://pypi.org/project/google-cloud-bigquery/

Some drivers have dependencies that cannot be installed using pip and still need to be installed manually.

Run your first diff

Once you've installed data-diff, you can run it from the command line.

data-diff DB1_URI TABLE1_NAME DB2_URI TABLE2_NAME [OPTIONS]

Be sure to read the docs for detailed instructions how to build one of these commands depending on your database setup.

Code Example: Diff Tables Between Databases

Here's an example command for your copy/pasting, taken from the screenshot above when we diffed data between Snowflake and Postgres.

data-diff \
  postgresql://<username>:'<password>'@localhost:5432/<database> \
  <table> \
  "snowflake://<username>:<password>@<password>/<DATABASE>/<SCHEMA>?warehouse=<WAREHOUSE>&role=<ROLE>" \
  <TABLE> \
  -k activity_id \
  -c activity \
  -w "event_timestamp < '2022-10-10'"

Code Example: Diff Tables Within a Database

data-diff \
  "snowflake://<username>:<password>@<password>/<DATABASE>/<SCHEMA_1>?warehouse=<WAREHOUSE>&role=<ROLE>" <TABLE_1> \
  <SCHEMA_2>.<TABLE_2> \
  -k org_id \
  -c created_at -c is_internal \
  -w "org_id != 1 and org_id < 2000" \
  -m test_results_%t \
  --materialize-all-rows \
  --table-write-limit 10000

In both code examples, I've used <> carrots to represent values that should be replaced with your values in the database connection strings. For the flags (-k, -c, etc.), I opted for "real" values (org_id, is_internal) to give you a more realistic view of what your command will look like.

We're here to help!

We're here to help! Please post any questions in GitHub Discussions.

How to Use

How to Contribute

  • Feel free to open an issue or contribute to the project by working on an existing issue.
  • Please read the contributing guidelines to get started.
  • To add a new database driver, check out docs.

Big thanks to everyone who contributed so far:

Technical Explanation

Check out this technical explanation of how data-diff works.

Analytics

License

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

data-diff's People

Contributors

erezsh avatar dlawin avatar sirupsen avatar pik94 avatar cfernhout avatar leoebfolsom avatar dbeatty10 avatar jardayn avatar danthelion avatar kylemcnair avatar glebmezh avatar williebsweet avatar nolar avatar danieldiamond avatar franloza avatar jaypeedevlin avatar vvkh avatar daniel-leicht avatar gunnarmorling avatar kning avatar kianmeng avatar segv avatar mattdelac avatar nklsw avatar jptoor avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.