Skip to main content

DataGuard 🛡️

Data Quality Framework with Schema Drift Detection, Validation Engine & Lineage Tracking

Python DuckDB License

DataGuard is a lightweight, open-source data quality framework that helps data engineers catch schema changes, validate data quality, and track column-level lineage—all without expensive enterprise tools.

🌐 Try the Live Demo (Vercel) — Multi-Table Engine, SQL Lab, and interactive lineage. Your data never leaves your machine.


✨ Features

  • Schema Inference & Drift Detection — Automatically detect when your data structure changes
  • Validation Rules Engine — Define rules in YAML, get actionable failure reports
  • Lineage Tracking — Track column-level data flow from source to output
  • Data Contracts — Auto-generate contracts for cross-team agreements
  • Zero Cost — DuckDB + SQLite, no cloud dependencies
  • Privacy First — Browser demo processes files locally via WebAssembly

🏗️ Architecture

┌─────────────────────────────────────────────────────────────────┐
│                         DataGuard                                │
├─────────────────────────────────────────────────────────────────┤
│                                                                  │
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐       │
│  │   SOURCES    │    │  PROCESSING  │    │   OUTPUTS    │       │
│  │  CSV/Parquet │───▶│  DuckDB      │───▶│  Reports     │       │
│  │  Databases   │    │  Engine      │    │  Alerts      │       │
│  │  Excel       │    │              │    │  Contracts   │       │
│  └──────────────┘    └──────────────┘    └──────────────┘       │
│          │                  │                   │                │
│          ▼                  ▼                   ▼                │
│  ┌─────────────────────────────────────────────────────────┐    │
│  │              METADATA STORE (SQLite)                     │    │
│  │  • Schema snapshots    • Validation history              │    │
│  │  • Lineage graph       • Data contracts                  │    │
│  └─────────────────────────────────────────────────────────┘    │
│                                                                  │
└─────────────────────────────────────────────────────────────────┘

🚀 Quick Start

Installation

# Clone the repository
git clone https://github.com/ayushvarma7/DataGuard.git
cd DataGuard

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -e .

Install from PyPI

pip install dataguard-drift          # CLI + library
pip install "dataguard-drift[ui]"    # + Streamlit dashboard

The import name and command stay dataguard.

Basic Usage

# Infer schema from a file
dataguard schema infer ./data/matches.csv --name matches

# Check for schema drift
dataguard schema diff matches

# Run validations
dataguard validate matches --rules ./rules/matches.yaml

# View lineage
dataguard lineage show revenue_report --format mermaid

# Generate data contract
dataguard contract generate matches

# Launch dashboard
dataguard ui

📁 Project Structure

dataguard/
├── dataguard/
│   ├── __init__.py
│   ├── cli.py                 # Typer CLI application
│   ├── core/
│   │   ├── __init__.py
│   │   ├── schema.py          # Schema inference & drift detection
│   │   ├── validator.py       # Validation rules engine
│   │   ├── lineage.py         # Lineage tracking & DAG
│   │   └── contracts.py       # Data contract generation
│   ├── storage/
│   │   ├── __init__.py
│   │   ├── metadata.py        # SQLite operations
│   │   └── models.py          # Pydantic data models
│   ├── engine/
│   │   ├── __init__.py
│   │   └── duckdb_engine.py   # DuckDB query execution
│   └── ui/
│       ├── __init__.py
│       └── dashboard.py       # Streamlit dashboard
├── web/                       # Browser demo (React + DuckDB-WASM)
│   ├── src/
│   ├── public/
│   └── package.json
├── tests/
│   ├── test_schema.py
│   ├── test_validator.py
│   └── test_lineage.py
├── examples/
│   ├── sports_tv/             # Sample SportsTV Germany dataset
│   │   ├── matches.csv
│   │   ├── leagues.csv
│   │   └── rules.yaml
│   └── ecommerce/             # Additional example
├── docs/
│   ├── getting-started.md
│   ├── validation-rules.md
│   └── lineage-tracking.md
├── pyproject.toml
├── README.md
└── LICENSE

🛠️ Tech Stack

Component Technology Why
Query Engine DuckDB Fast, in-process, handles CSV/Parquet natively
Metadata Store SQLite Simple, file-based, zero configuration
CLI Framework Typer Modern CLI with auto-generated help
Data Models Pydantic Validation & serialization
Dashboard Streamlit Rapid UI development
Web Demo React + DuckDB-WASM Browser-based, no server needed
Config Format YAML Human-readable rule definitions
Visualization Mermaid Lineage diagrams

📋 Development Roadmap

Phase 1: Schema Inference & Drift Detection ✅

  • Project setup & dependencies
  • DuckDB engine wrapper
  • Schema inference from CSV/Parquet
  • SQLite metadata store
  • Schema snapshot storage
  • Drift detection algorithm
  • CLI commands: schema infer, schema diff
  • Unit tests

Phase 2: Validation Rules Engine ✅

  • YAML rule parser
  • Validation rule types (not_null, unique, range, etc.)
  • SQL query generator for each rule type
  • Validation executor
  • Report generator (JSON, terminal table)
  • CLI command: validate
  • Unit tests

Phase 3: Lineage Tracking ✅

  • Lineage data model (DAG)
  • Decorator-based lineage capture (@track_lineage)
  • Lineage storage in SQLite
  • Mermaid diagram generator (CLI & Dashboard)
  • CLI commands: lineage show
  • Unit tests

Phase 4: Data Contracts & Polish ✅

  • Contract schema definition (DataContract)
  • Auto-generate contracts from schema + rules (contract generate)
  • Contract verification (contract verify)
  • Streamlit dashboard (Schema, Drift, Lineage)
  • Documentation Polish

Phase 5: Browser-Native Dashboard ✅

  • React + Next.js 16 setup
  • DuckDB-WASM Multi-Table Integration
  • Local-first Privacy Design
  • Visual Data Profiling (Histograms)
  • Full SQL Lab & Workbench
  • Multi-Source Lineage Tracking
  • Vercel Deployment Optimization

📖 Documentation

Validation Rule Types

# rules/matches.yaml
dataset: matches
validations:
  - column: match_id
    rules:
      - type: not_null
      - type: unique

  - column: viewer_count
    rules:
      - type: not_null
      - type: in_range
        min: 0
        max: 100000000

  - column: broadcast_date
    rules:
      - type: not_null
      - type: freshness
        max_age_hours: 48

  - column: league_id
    rules:
      - type: referential_integrity
        parent_table: leagues
        parent_column: id

Available Rule Types

Rule Description Parameters
not_null Column has no null values —
unique All values are unique —
in_range Numeric values within bounds min, max
in_set Values from allowed list values: [a, b, c]
regex_match String matches pattern pattern
freshness Data not older than threshold max_age_hours
referential_integrity FK exists in parent parent_table, parent_column
row_count Table has expected rows min, max

☁️ Deployment (Vercel)

Deploying DataGuard is seamless. Since it's a static Next.js application, it can be hosted on Vercel with zero configuration.

  1. Fork this repository.
  2. Connect your fork to Vercel.
  3. Vercel will auto-detect Next.js and build using the optimized Webpack configuration.
  4. Enjoy your private, edge-distributed data quality platform!

🧪 Running Tests

# Run all tests
pytest

# Run with coverage
pytest --cov=dataguard

# Run specific test file
pytest tests/test_schema.py -v

🤝 Contributing

Contributions are welcome! Please read our issues for details.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


🙏 Acknowledgments

  • DuckDB — The amazing in-process SQL engine
  • Great Expectations — Inspiration for validation patterns
  • dbt — Inspiration for lineage concepts

Built with ❤️ by Ayush Varma

Metadata

Release files for dataguard-drift 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dataguard-drift 0.1.0
File Size Uploaded Provenance Actions
dataguard_drift-0.1.0.tar.gz 31.8 kB With provenance Details for dataguard_drift-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dataguard-drift 0.1.0
File Interpreter ABI Platform Actions
dataguard_drift-0.1.0-py3-none-any.whl Python 3 none any Details for dataguard_drift-0.1.0-py3-none-any.whl

Total release size: 57.8 kB

Release files / dataguard_drift-0.1.0.tar.gz

Download URL dataguard_drift-0.1.0.tar.gz
Size 31.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a879c980ec8b47704b17b7c271889079df9fc1dc54cfc75b60007302c9c397d3
BLAKE2b-256 checksum
How to use checksums
f3ccf50719148638af112b903f1dddcb65c590c7dbaebcaf39a08540a34d29c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / dataguard_drift-0.1.0-py3-none-any.whl

Download URL dataguard_drift-0.1.0-py3-none-any.whl
Size 26.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
75d4b181300ab41f7163ec454712e56ebd6130cc75c74771da9bc4a1271a7e89
BLAKE2b-256 checksum
How to use checksums
e005e6deaf2cbf35a312c8016b2a0a908861181b0b6f7606fd6650b4a0d44b10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Security for dataguard-drift 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dataguard_drift-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page