Metadata-Version: 2.4
Name: quack-diff
Version: 0.0.10
Summary: Regression testing tool for modern data warehouses, powered by duck-db
Project-URL: Homepage, https://github.com/matteorenoldi/quack-diff
Project-URL: Repository, https://github.com/matteorenoldi/quack-diff
Project-URL: Issues, https://github.com/matteorenoldi/quack-diff/issues
Author-email: Matteo Renoldi <matteo.renoldi@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: data,data-quality,diff,duckdb,regression-testing,snowflake
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Database
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.12
Requires-Dist: duckdb>=1.0.0
Requires-Dist: pydantic-settings>=2.0.0
Requires-Dist: pyyaml>=6.0.0
Requires-Dist: rich>=13.0.0
Requires-Dist: typer[all]>=0.12.0
Provides-Extra: snowflake
Requires-Dist: pandas>=2.0.0; extra == 'snowflake'
Requires-Dist: pyarrow>=14.0.0; extra == 'snowflake'
Requires-Dist: snowflake-connector-python>=3.0.0; extra == 'snowflake'
Description-Content-Type: text/markdown

# quack-diff

[![CI](https://github.com/mattcristal/quack-diff/actions/workflows/ci.yml/badge.svg?event=push)](https://github.com/mattcristal/quack-diff/actions/workflows/ci.yml?query=branch%3Amain)
[![codecov](https://codecov.io/gh/mattcristal/quack-diff/graph/badge.svg)](https://codecov.io/gh/mattcristal/quack-diff)

![quack-diff logo](images/quack_diff.jpg)

The zero-dependency regression testing tool for modern data warehouses.

> [!WARNING]
> ⚠️ This project is high work-in-progress.

---

**Documentation**: [github.io/quack-diff](https://mattcristal.github.io/quack-diff/)

---

## Features

- **DuckDB-First Architecture**: Uses DuckDB as a universal adapter for database connectivity
- **Dialect-Safe Hashing**: Handles NULL values and type mismatches correctly across databases
- **Time-Travel Support**: Compare data against historical snapshots (Snowflake, Delta Lake)
- **CI/CD Ready**: Exit codes for pipeline integration, environment variable configuration
- **User-Friendly**: Rich terminal output with beautiful diff tables

## Installation

```bash
uv add quack-diff
```

## Quick Start

### Basic compare

```bash
# Compare two tables
quack-diff compare --source db1.users --target db2.users --key id

# Compare with threshold (allow up to 1% difference)
quack-diff compare --source prod.orders --target dev.orders --key order_id --threshold 0.01
```

### Time-Travel compare (Snowflake)

```bash
# Compare current data with 5 minutes ago
quack-diff compare \
  --source snowflake.orders \
  --target snowflake.orders \
  --source-at "5 minutes ago" \
  --key order_id
```

### Schema Comparison

```bash
quack-diff schema --source db1.users --target db2.users
```

## Configuration

quack-diff supports configuration via environment variables:

```bash
# Snowflake
export QUACK_DIFF_SNOWFLAKE_ACCOUNT="your-account"
export QUACK_DIFF_SNOWFLAKE_USER="your-user"
export QUACK_DIFF_SNOWFLAKE_PASSWORD="your-password"
```

Or via a `quack-diff.yaml` configuration file:

```yaml
snowflake:
  account: your-account
  user: your-user
  database: your-database

defaults:
  threshold: 0.0
```

## How It Works

quack-diff leverages DuckDB's extension system to connect to external databases:

1. **Attach**: Mount remote databases using DuckDB extensions (snowflake)
2. **Hash**: Generate row-level hashes using dialect-safe SQL (handles NULLs, type coercion)
3. **Compare**: Identify mismatches by comparing hash values
4. **Report**: Display results in beautiful terminal tables

## Development

```bash
# Clone the repository
git clone https://github.com/matteorenoldi/quack-diff.git
cd quack-diff

# Install with dev dependencies
uv sync

# Install pre-commit hooks
uv run prek install

# Run tests
uv run pytest

# Lint
uv run ruff check .
```

## License

MIT License - see [LICENSE](LICENSE) for details.
