2 min read
|
Saved February 14, 2026
|
Copied!
Do you care about this?
This article discusses a CLI tool called TableDiff for comparing data between two tables across various databases. It supports different database adapters and offers features like schema-only comparison, cross-database diffing, and the ability to filter results with WHERE conditions.
If you do, here's more
The article presents a command-line interface (CLI) tool called `tablediff`, designed for comparing data between two tables across various databases. Itβs available on PyPi and requires Python 3.10 or higher. The tool has been tested with DuckDB and Snowflake but supports multiple database adapters such as MySQL, PostgreSQL, BigQuery, and more. Installation varies slightly depending on the desired adapter, with a catch-all option to install all adapters at once using `pip install tablediff-cli[all]`.
Users can perform table comparisons by running commands that specify the tables, primary key, and connection strings. The tables can be referenced in different formats, and specific requirements exist for Snowflake, like using uppercase for identifiers. The tool allows schema-only comparisons, CSV file comparisons, and even cross-database diffing. Options to pass additional WHERE conditions during comparisons enhance its flexibility. A notable feature is the `--extended` flag, which provides in-depth output, highlighting common and unique columns, as well as unmatched IDs.
To set up the tool locally, users need to clone the repository, create a virtual environment, and run tests. The article also mentions the use of pre-commit hooks to ensure code quality and provides a Python script for generating test data in DuckDB. Future enhancements are suggested, including column-by-column comparisons and support for dbt.
Questions about this article
No questions yet.