data-contract-validator


Namedata-contract-validator JSON
Version 1.0.3 PyPI version JSON
download
home_pageNone
SummaryAdding pre-commit-fixes
upload_time2025-08-10 16:06:10
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords dbt fastapi contract-testing api-validation data-engineering schema-validation ci-cd devops
VCS
bugtrack_url
requirements pydantic PyYAML requests click
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🛡️ Data Contract Validator

> **Prevent production API breaks by validating data contracts between your data pipelines and API frameworks**

[![PyPI version](https://badge.fury.io/py/data-contract-validator.svg)](https://badge.fury.io/py/data-contract-validator)
[![Tests](https://github.com/OGsiji/data-contract-validator/workflows/Tests/badge.svg)](https://github.com/OGsiji/data-contract-validator/actions)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## 🎯 **What This Solves**

Ever deployed a DBT model change only to break your FastAPI in production? This tool prevents that by validating data contracts between your data pipelines and APIs **before** deployment.

```
DBT Models          Contract           FastAPI Models
(What data          Validator          (What APIs
 produces)          ↕️ VALIDATES ↕️      expect)
     ↓                   ↓                   ↓
   Schema              Finds              Schema
 Extraction          Mismatches         Extraction
```

## ⚡ **Quick Start**

### **Installation**
```bash
pip install data-contract-validator
```

### **30-Second Setup**
```bash
# 1. Initialize in your project
contract-validator init --interactive

# 2. Test setup
contract-validator test

# 3. Validate contracts
contract-validator validate

# 4. Commit and push - you're protected! 🛡️
```

### **Basic Usage**
```bash
# Validate local DBT project against FastAPI models
contract-validator validate \
  --dbt-project ./my-dbt-project \
  --fastapi-local ./my-api/models.py

# Validate across repositories (microservices)
contract-validator validate \
  --dbt-project . \
  --fastapi-repo "my-org/my-api-repo" \
  --fastapi-path "app/models.py"
```

## 🔍 **Real Example: Production Validation**

**Actual output from a production analytics project:**

```bash
$ contract-validator validate

🔍 Starting contract validation...
📊 Extracting source schemas...
   ✅ Found 14 DBT models (user_analytics_summary: 54 columns)
🎯 Extracting target schemas...  
   ✅ Found 3 FastAPI models
🔍 Validating schema compatibility...

🛡️ Results:
✅ PASSED - 0 critical issues (no production breaks!)
⚠️  42 warnings (type mismatches to review)

Issues caught:
⚠️  user_analytics_summary.age_years: source 'varchar' vs target 'integer'
⚠️  user_analytics_summary.is_verified: source 'varchar' vs target 'boolean'
⚠️  user_analytics_summary.user_created_at: source 'varchar' vs target 'timestamp'

🎉 Your API contracts are protected!
```

## 🚨 **What It Prevents**

### **Before Data Contract Validation:**
```sql
-- Analytics team changes DBT model
select
    user_id,
    email,
    -- total_orders,  ❌ REMOVED this column
    revenue
from users
```

```python
# API team's FastAPI model (unchanged)
class UserAnalytics(BaseModel):
    user_id: str
    email: str
    total_orders: int  # ❌ Still expects this!
    revenue: float
```

**Result:** 💥 **Production API breaks**, angry customers, 2AM debugging

### **After Data Contract Validation:**
```bash
$ git push

❌ VALIDATION FAILED
💥 user_analytics.total_orders: FastAPI REQUIRES column but DBT removed it
🔧 Fix: Add 'total_orders' back to DBT model or update FastAPI model

# Push blocked until fixed ✋
```

**Result:** 🛡️ **Production protected**, issues caught in CI/CD

## 🛠️ **Pre-commit Integration**

### **Automatic Setup (Recommended)**
```bash
# Initialize with pre-commit support
contract-validator init --interactive
contract-validator setup-precommit --install-hooks

# Now every commit validates contracts automatically! 🛡️
```

### **Manual Setup**
If you prefer manual setup:

1. **Install pre-commit:**
   ```bash
   pip install pre-commit
   ```

2. **Add to `.pre-commit-config.yaml`:**
   ```yaml
   repos:
     - repo: https://github.com/OGsiji/data-contract-validator
       rev: v1.0.0
       hooks:
         - id: contract-validation
           name: Validate Data Contracts
           files: '^(.*models.*\.(sql|py)|\.retl-validator\.yml|dbt_project\.yml)$'
   ```

3. **Install hooks:**
   ```bash
   pre-commit install
   ```

### **How It Works**
```bash
$ git add models/user_analytics.sql
$ git commit -m "update user analytics model"

# Pre-commit automatically runs:
🔍 Validating Data Contracts...
✅ Contract validation passed
[main abc1234] update user analytics model
```

### **On Validation Failure**
```bash
$ git commit -m "remove important column"

🔍 Validating Data Contracts...
❌ CRITICAL: user_analytics.total_revenue missing
💡 Fix the issue before committing

# Commit blocked until fixed! 🛡️
```

### **Skip Validation (Emergency Only)**
```bash
# Only for emergencies!
git commit -m "emergency fix" --no-verify
```

### **Benefits of Pre-commit Integration**
- ✅ **Catches issues before they reach CI/CD**
- ✅ **Faster feedback loop** (seconds, not minutes)
- ✅ **No broken commits** in your git history
- ✅ **Team protection** - everyone gets validation
- ✅ **Zero configuration** after setup

## 📦 **GitHub Actions Integration**

Add this to `.github/workflows/validate-contracts.yml`:

```yaml
name: 🛡️ Data Contract Validation

on:
  pull_request:
    paths:
      - 'models/**/*.sql'
      - 'dbt_project.yml'
      - '**/*models*.py'

jobs:
  validate-contracts:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: actions/setup-python@v4
      with:
        python-version: '3.9'
    
    - name: Validate contracts
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: |
        pip install data-contract-validator
        contract-validator validate
```

**Auto-generated when you run `contract-validator init`!**

## 🔧 **Configuration**

### **Auto-Generated Config (`.retl-validator.yml`)**
```yaml
version: '1.0'
name: 'my-project-contracts'

source:
  dbt:
    project_path: '.'
    auto_compile: true

target:
  fastapi:
    # For GitHub repos
    type: "github"
    repo: "my-org/my-api"
    path: "app/models.py"
    
    # For local files
    # type: "local"
    # path: "../my-api/models.py"

validation:
  fail_on: ['missing_tables', 'missing_required_columns']
  warn_on: ['type_mismatches', 'missing_optional_columns']
```

### **Command Line Options**
```bash
contract-validator validate \
  --dbt-project ./dbt-project \           # DBT project path
  --fastapi-repo "org/repo" \             # GitHub repo
  --fastapi-path "app/models.py" \        # Path to models
  --github-token "$GITHUB_TOKEN" \        # For private repos
  --output json                           # json, terminal, github
```

## 🚀 **Supported Frameworks**

### **Data Sources ✅**
- **DBT** (all adapters: Snowflake, BigQuery, Redshift, etc.)

### **API Frameworks ✅**  
- **FastAPI** (Pydantic + SQLModel)

### **Coming Soon 🔄**
- Django, Flask-SQLAlchemy
- Databricks, Airflow
- [Request other frameworks](https://github.com/OGsiji/data-contract-validator/issues)

## 🎯 **Output Formats**

### **Terminal (Default)**
```bash
🛡️ Data Contract Validation Results:
Status: ✅ PASSED
Critical: 0 | Warnings: 5

⚠️  Warnings:
  user_analytics.age: Type mismatch (varchar vs integer)
  user_analytics.country: Type mismatch (integer vs varchar)

🎉 Your API contracts are protected!
```

### **JSON (for CI/CD)**
```json
{
  "success": true,
  "critical_issues": 0,
  "warnings": 5,
  "issues": [
    {
      "severity": "warning",
      "table": "user_analytics", 
      "column": "age",
      "message": "Type mismatch: source 'varchar' vs target 'integer'",
      "suggested_fix": "Update target to expect 'varchar' or fix source type"
    }
  ]
}
```

### **GitHub Actions**
```bash
::warning::user_analytics.age: Type mismatch detected
✅ Contract validation passed - no critical issues
```

## 🏗️ **Architecture**

### **Simple Python API**
```python
from data_contract_validator import ContractValidator, DBTExtractor, FastAPIExtractor

# Initialize extractors
dbt = DBTExtractor(project_path='./dbt-project')
fastapi = FastAPIExtractor.from_github_repo('my-org/my-api', 'app/models.py')

# Run validation
validator = ContractValidator(source=dbt, target=fastapi)
result = validator.validate()

if not result.success:
    print(f"❌ {len(result.critical_issues)} critical issues found")
    for issue in result.critical_issues:
        print(f"💥 {issue.table}.{issue.column}: {issue.message}")
```

### **CLI Interface**
```bash
# Interactive setup
contract-validator init --interactive

# Test configuration
contract-validator test

# Run validation
contract-validator validate

# Setup pre-commit hooks
contract-validator setup-precommit --install-hooks

# Multiple output formats
contract-validator validate --output json
```

## 🔄 **Development Workflow**

### **With Pre-commit (Recommended)**
```bash
# Team workflow with automated validation
git clone your-dbt-project
cd your-dbt-project

# One-time setup for new team members
contract-validator init --interactive
contract-validator setup-precommit --install-hooks

# Protected development workflow:
# 1. Make changes to DBT models
# 2. git add models/my_model.sql
# 3. git commit -m "update model"  # ← Validation runs here automatically
# 4. If validation passes → commit succeeds
# 5. If validation fails → fix issues first
# 6. git push  # ← CI/CD validation as backup
```

### **Manual Workflow**
```bash
# Traditional workflow
# 1. Make changes
# 2. contract-validator validate  # Manual validation
# 3. git commit
# 4. git push
```

## 🤝 **Contributing**

We welcome contributions! This tool is actively used in production.

### **Development Setup**
```bash
git clone https://github.com/OGsiji/data-contract-validator
cd data-contract-validator
pip install -e ".[dev]"
pytest
```

### **Adding New Extractors**
```python
from retl_validator.extractors import BaseExtractor

class MyFrameworkExtractor(BaseExtractor):
    def extract_schemas(self) -> Dict[str, Schema]:
        # Your implementation
        return schemas
```

### **Reporting Issues**
- 🐛 **Bugs**: [GitHub Issues](https://github.com/OGsiji/data-contract-validator/issues)
- 💡 **Features**: [GitHub Discussions](https://github.com/OGsiji/data-contract-validator/discussions)

## 📚 **Documentation**

- **[Quick Start Guide](https://github.com/OGsiji/data-contract-validator#quick-start)** - Get running in 2 minutes
- **[Configuration Reference](https://github.com/OGsiji/data-contract-validator/blob/main/examples)** - All config options
- **[GitHub Actions Setup](https://github.com/OGsiji/data-contract-validator/blob/main/examples/.github_actions)** - CI/CD integration
- **[Examples](https://github.com/OGsiji/data-contract-validator/tree/main/examples)** - Real-world usage
- **[Pre-commit Integration](https://github.com/OGsiji/data-contract-validator#pre-commit-integration)** - Automated validation

## 🎉 **Real-World Usage**

This tool is actively preventing production incidents in:
- **Analytics pipelines** with 50+ DBT models
- **Microservices architectures** with multiple APIs
- **Data engineering teams** using Snowflake, BigQuery, Redshift
- **Cross-repository validation** in large organizations

**Proven to catch:**
- ✅ **Type mismatches** (varchar vs integer)
- ✅ **Missing columns** (API expects columns DBT doesn't provide)
- ✅ **Schema drift** (gradual model changes)
- ✅ **Breaking changes** before they reach production

## 🛡️ **Multiple Layers of Protection**

1. **Pre-commit hooks**: Immediate feedback (fastest)
2. **CI/CD validation**: Team protection (backup)
3. **Manual validation**: Development testing
4. **Configuration files**: Team standards

This creates a comprehensive safety net for your data contracts.

## 📄 **License**

MIT License - see [LICENSE](https://github.com/OGsiji/data-contract-validator/blob/main/LICENSE) for details.

## 🆘 **Support**

- 🐛 **Issues**: [GitHub Issues](https://github.com/OGsiji/data-contract-validator/issues)
- 💬 **Discussions**: [GitHub Discussions](https://github.com/OGsiji/data-contract-validator/discussions)
- 📧 **Email**: ogunniransiji@gmail.com

## ⭐ **Star the Project**

If this tool helps you prevent production incidents, please ⭐ star the repository!

---

**🛡️ Built by data engineers, for data engineers. Stop breaking production with data changes!**

## 🚀 **Get Started Now**

```bash
pip install data-contract-validator
contract-validator init --interactive
contract-validator setup-precommit --install-hooks
# 2 minutes to production protection with automated validation!
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "data-contract-validator",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Ogunniran Siji <ogunniransiji@gmail.com>",
    "keywords": "dbt, fastapi, contract-testing, api-validation, data-engineering, schema-validation, ci-cd, devops",
    "author": null,
    "author_email": "Ogunniran Siji <ogunniransiji@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/40/58/035b7f6cfd438a4711150ea45d99034b9f3e12d8369f45e7e82553c7f490/data_contract_validator-1.0.3.tar.gz",
    "platform": null,
    "description": "# \ud83d\udee1\ufe0f Data Contract Validator\n\n> **Prevent production API breaks by validating data contracts between your data pipelines and API frameworks**\n\n[![PyPI version](https://badge.fury.io/py/data-contract-validator.svg)](https://badge.fury.io/py/data-contract-validator)\n[![Tests](https://github.com/OGsiji/data-contract-validator/workflows/Tests/badge.svg)](https://github.com/OGsiji/data-contract-validator/actions)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n## \ud83c\udfaf **What This Solves**\n\nEver deployed a DBT model change only to break your FastAPI in production? This tool prevents that by validating data contracts between your data pipelines and APIs **before** deployment.\n\n```\nDBT Models          Contract           FastAPI Models\n(What data          Validator          (What APIs\n produces)          \u2195\ufe0f VALIDATES \u2195\ufe0f      expect)\n     \u2193                   \u2193                   \u2193\n   Schema              Finds              Schema\n Extraction          Mismatches         Extraction\n```\n\n## \u26a1 **Quick Start**\n\n### **Installation**\n```bash\npip install data-contract-validator\n```\n\n### **30-Second Setup**\n```bash\n# 1. Initialize in your project\ncontract-validator init --interactive\n\n# 2. Test setup\ncontract-validator test\n\n# 3. Validate contracts\ncontract-validator validate\n\n# 4. Commit and push - you're protected! \ud83d\udee1\ufe0f\n```\n\n### **Basic Usage**\n```bash\n# Validate local DBT project against FastAPI models\ncontract-validator validate \\\n  --dbt-project ./my-dbt-project \\\n  --fastapi-local ./my-api/models.py\n\n# Validate across repositories (microservices)\ncontract-validator validate \\\n  --dbt-project . \\\n  --fastapi-repo \"my-org/my-api-repo\" \\\n  --fastapi-path \"app/models.py\"\n```\n\n## \ud83d\udd0d **Real Example: Production Validation**\n\n**Actual output from a production analytics project:**\n\n```bash\n$ contract-validator validate\n\n\ud83d\udd0d Starting contract validation...\n\ud83d\udcca Extracting source schemas...\n   \u2705 Found 14 DBT models (user_analytics_summary: 54 columns)\n\ud83c\udfaf Extracting target schemas...  \n   \u2705 Found 3 FastAPI models\n\ud83d\udd0d Validating schema compatibility...\n\n\ud83d\udee1\ufe0f Results:\n\u2705 PASSED - 0 critical issues (no production breaks!)\n\u26a0\ufe0f  42 warnings (type mismatches to review)\n\nIssues caught:\n\u26a0\ufe0f  user_analytics_summary.age_years: source 'varchar' vs target 'integer'\n\u26a0\ufe0f  user_analytics_summary.is_verified: source 'varchar' vs target 'boolean'\n\u26a0\ufe0f  user_analytics_summary.user_created_at: source 'varchar' vs target 'timestamp'\n\n\ud83c\udf89 Your API contracts are protected!\n```\n\n## \ud83d\udea8 **What It Prevents**\n\n### **Before Data Contract Validation:**\n```sql\n-- Analytics team changes DBT model\nselect\n    user_id,\n    email,\n    -- total_orders,  \u274c REMOVED this column\n    revenue\nfrom users\n```\n\n```python\n# API team's FastAPI model (unchanged)\nclass UserAnalytics(BaseModel):\n    user_id: str\n    email: str\n    total_orders: int  # \u274c Still expects this!\n    revenue: float\n```\n\n**Result:** \ud83d\udca5 **Production API breaks**, angry customers, 2AM debugging\n\n### **After Data Contract Validation:**\n```bash\n$ git push\n\n\u274c VALIDATION FAILED\n\ud83d\udca5 user_analytics.total_orders: FastAPI REQUIRES column but DBT removed it\n\ud83d\udd27 Fix: Add 'total_orders' back to DBT model or update FastAPI model\n\n# Push blocked until fixed \u270b\n```\n\n**Result:** \ud83d\udee1\ufe0f **Production protected**, issues caught in CI/CD\n\n## \ud83d\udee0\ufe0f **Pre-commit Integration**\n\n### **Automatic Setup (Recommended)**\n```bash\n# Initialize with pre-commit support\ncontract-validator init --interactive\ncontract-validator setup-precommit --install-hooks\n\n# Now every commit validates contracts automatically! \ud83d\udee1\ufe0f\n```\n\n### **Manual Setup**\nIf you prefer manual setup:\n\n1. **Install pre-commit:**\n   ```bash\n   pip install pre-commit\n   ```\n\n2. **Add to `.pre-commit-config.yaml`:**\n   ```yaml\n   repos:\n     - repo: https://github.com/OGsiji/data-contract-validator\n       rev: v1.0.0\n       hooks:\n         - id: contract-validation\n           name: Validate Data Contracts\n           files: '^(.*models.*\\.(sql|py)|\\.retl-validator\\.yml|dbt_project\\.yml)$'\n   ```\n\n3. **Install hooks:**\n   ```bash\n   pre-commit install\n   ```\n\n### **How It Works**\n```bash\n$ git add models/user_analytics.sql\n$ git commit -m \"update user analytics model\"\n\n# Pre-commit automatically runs:\n\ud83d\udd0d Validating Data Contracts...\n\u2705 Contract validation passed\n[main abc1234] update user analytics model\n```\n\n### **On Validation Failure**\n```bash\n$ git commit -m \"remove important column\"\n\n\ud83d\udd0d Validating Data Contracts...\n\u274c CRITICAL: user_analytics.total_revenue missing\n\ud83d\udca1 Fix the issue before committing\n\n# Commit blocked until fixed! \ud83d\udee1\ufe0f\n```\n\n### **Skip Validation (Emergency Only)**\n```bash\n# Only for emergencies!\ngit commit -m \"emergency fix\" --no-verify\n```\n\n### **Benefits of Pre-commit Integration**\n- \u2705 **Catches issues before they reach CI/CD**\n- \u2705 **Faster feedback loop** (seconds, not minutes)\n- \u2705 **No broken commits** in your git history\n- \u2705 **Team protection** - everyone gets validation\n- \u2705 **Zero configuration** after setup\n\n## \ud83d\udce6 **GitHub Actions Integration**\n\nAdd this to `.github/workflows/validate-contracts.yml`:\n\n```yaml\nname: \ud83d\udee1\ufe0f Data Contract Validation\n\non:\n  pull_request:\n    paths:\n      - 'models/**/*.sql'\n      - 'dbt_project.yml'\n      - '**/*models*.py'\n\njobs:\n  validate-contracts:\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v4\n    - uses: actions/setup-python@v4\n      with:\n        python-version: '3.9'\n    \n    - name: Validate contracts\n      env:\n        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n      run: |\n        pip install data-contract-validator\n        contract-validator validate\n```\n\n**Auto-generated when you run `contract-validator init`!**\n\n## \ud83d\udd27 **Configuration**\n\n### **Auto-Generated Config (`.retl-validator.yml`)**\n```yaml\nversion: '1.0'\nname: 'my-project-contracts'\n\nsource:\n  dbt:\n    project_path: '.'\n    auto_compile: true\n\ntarget:\n  fastapi:\n    # For GitHub repos\n    type: \"github\"\n    repo: \"my-org/my-api\"\n    path: \"app/models.py\"\n    \n    # For local files\n    # type: \"local\"\n    # path: \"../my-api/models.py\"\n\nvalidation:\n  fail_on: ['missing_tables', 'missing_required_columns']\n  warn_on: ['type_mismatches', 'missing_optional_columns']\n```\n\n### **Command Line Options**\n```bash\ncontract-validator validate \\\n  --dbt-project ./dbt-project \\           # DBT project path\n  --fastapi-repo \"org/repo\" \\             # GitHub repo\n  --fastapi-path \"app/models.py\" \\        # Path to models\n  --github-token \"$GITHUB_TOKEN\" \\        # For private repos\n  --output json                           # json, terminal, github\n```\n\n## \ud83d\ude80 **Supported Frameworks**\n\n### **Data Sources \u2705**\n- **DBT** (all adapters: Snowflake, BigQuery, Redshift, etc.)\n\n### **API Frameworks \u2705**  \n- **FastAPI** (Pydantic + SQLModel)\n\n### **Coming Soon \ud83d\udd04**\n- Django, Flask-SQLAlchemy\n- Databricks, Airflow\n- [Request other frameworks](https://github.com/OGsiji/data-contract-validator/issues)\n\n## \ud83c\udfaf **Output Formats**\n\n### **Terminal (Default)**\n```bash\n\ud83d\udee1\ufe0f Data Contract Validation Results:\nStatus: \u2705 PASSED\nCritical: 0 | Warnings: 5\n\n\u26a0\ufe0f  Warnings:\n  user_analytics.age: Type mismatch (varchar vs integer)\n  user_analytics.country: Type mismatch (integer vs varchar)\n\n\ud83c\udf89 Your API contracts are protected!\n```\n\n### **JSON (for CI/CD)**\n```json\n{\n  \"success\": true,\n  \"critical_issues\": 0,\n  \"warnings\": 5,\n  \"issues\": [\n    {\n      \"severity\": \"warning\",\n      \"table\": \"user_analytics\", \n      \"column\": \"age\",\n      \"message\": \"Type mismatch: source 'varchar' vs target 'integer'\",\n      \"suggested_fix\": \"Update target to expect 'varchar' or fix source type\"\n    }\n  ]\n}\n```\n\n### **GitHub Actions**\n```bash\n::warning::user_analytics.age: Type mismatch detected\n\u2705 Contract validation passed - no critical issues\n```\n\n## \ud83c\udfd7\ufe0f **Architecture**\n\n### **Simple Python API**\n```python\nfrom data_contract_validator import ContractValidator, DBTExtractor, FastAPIExtractor\n\n# Initialize extractors\ndbt = DBTExtractor(project_path='./dbt-project')\nfastapi = FastAPIExtractor.from_github_repo('my-org/my-api', 'app/models.py')\n\n# Run validation\nvalidator = ContractValidator(source=dbt, target=fastapi)\nresult = validator.validate()\n\nif not result.success:\n    print(f\"\u274c {len(result.critical_issues)} critical issues found\")\n    for issue in result.critical_issues:\n        print(f\"\ud83d\udca5 {issue.table}.{issue.column}: {issue.message}\")\n```\n\n### **CLI Interface**\n```bash\n# Interactive setup\ncontract-validator init --interactive\n\n# Test configuration\ncontract-validator test\n\n# Run validation\ncontract-validator validate\n\n# Setup pre-commit hooks\ncontract-validator setup-precommit --install-hooks\n\n# Multiple output formats\ncontract-validator validate --output json\n```\n\n## \ud83d\udd04 **Development Workflow**\n\n### **With Pre-commit (Recommended)**\n```bash\n# Team workflow with automated validation\ngit clone your-dbt-project\ncd your-dbt-project\n\n# One-time setup for new team members\ncontract-validator init --interactive\ncontract-validator setup-precommit --install-hooks\n\n# Protected development workflow:\n# 1. Make changes to DBT models\n# 2. git add models/my_model.sql\n# 3. git commit -m \"update model\"  # \u2190 Validation runs here automatically\n# 4. If validation passes \u2192 commit succeeds\n# 5. If validation fails \u2192 fix issues first\n# 6. git push  # \u2190 CI/CD validation as backup\n```\n\n### **Manual Workflow**\n```bash\n# Traditional workflow\n# 1. Make changes\n# 2. contract-validator validate  # Manual validation\n# 3. git commit\n# 4. git push\n```\n\n## \ud83e\udd1d **Contributing**\n\nWe welcome contributions! This tool is actively used in production.\n\n### **Development Setup**\n```bash\ngit clone https://github.com/OGsiji/data-contract-validator\ncd data-contract-validator\npip install -e \".[dev]\"\npytest\n```\n\n### **Adding New Extractors**\n```python\nfrom retl_validator.extractors import BaseExtractor\n\nclass MyFrameworkExtractor(BaseExtractor):\n    def extract_schemas(self) -> Dict[str, Schema]:\n        # Your implementation\n        return schemas\n```\n\n### **Reporting Issues**\n- \ud83d\udc1b **Bugs**: [GitHub Issues](https://github.com/OGsiji/data-contract-validator/issues)\n- \ud83d\udca1 **Features**: [GitHub Discussions](https://github.com/OGsiji/data-contract-validator/discussions)\n\n## \ud83d\udcda **Documentation**\n\n- **[Quick Start Guide](https://github.com/OGsiji/data-contract-validator#quick-start)** - Get running in 2 minutes\n- **[Configuration Reference](https://github.com/OGsiji/data-contract-validator/blob/main/examples)** - All config options\n- **[GitHub Actions Setup](https://github.com/OGsiji/data-contract-validator/blob/main/examples/.github_actions)** - CI/CD integration\n- **[Examples](https://github.com/OGsiji/data-contract-validator/tree/main/examples)** - Real-world usage\n- **[Pre-commit Integration](https://github.com/OGsiji/data-contract-validator#pre-commit-integration)** - Automated validation\n\n## \ud83c\udf89 **Real-World Usage**\n\nThis tool is actively preventing production incidents in:\n- **Analytics pipelines** with 50+ DBT models\n- **Microservices architectures** with multiple APIs\n- **Data engineering teams** using Snowflake, BigQuery, Redshift\n- **Cross-repository validation** in large organizations\n\n**Proven to catch:**\n- \u2705 **Type mismatches** (varchar vs integer)\n- \u2705 **Missing columns** (API expects columns DBT doesn't provide)\n- \u2705 **Schema drift** (gradual model changes)\n- \u2705 **Breaking changes** before they reach production\n\n## \ud83d\udee1\ufe0f **Multiple Layers of Protection**\n\n1. **Pre-commit hooks**: Immediate feedback (fastest)\n2. **CI/CD validation**: Team protection (backup)\n3. **Manual validation**: Development testing\n4. **Configuration files**: Team standards\n\nThis creates a comprehensive safety net for your data contracts.\n\n## \ud83d\udcc4 **License**\n\nMIT License - see [LICENSE](https://github.com/OGsiji/data-contract-validator/blob/main/LICENSE) for details.\n\n## \ud83c\udd98 **Support**\n\n- \ud83d\udc1b **Issues**: [GitHub Issues](https://github.com/OGsiji/data-contract-validator/issues)\n- \ud83d\udcac **Discussions**: [GitHub Discussions](https://github.com/OGsiji/data-contract-validator/discussions)\n- \ud83d\udce7 **Email**: ogunniransiji@gmail.com\n\n## \u2b50 **Star the Project**\n\nIf this tool helps you prevent production incidents, please \u2b50 star the repository!\n\n---\n\n**\ud83d\udee1\ufe0f Built by data engineers, for data engineers. Stop breaking production with data changes!**\n\n## \ud83d\ude80 **Get Started Now**\n\n```bash\npip install data-contract-validator\ncontract-validator init --interactive\ncontract-validator setup-precommit --install-hooks\n# 2 minutes to production protection with automated validation!\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Adding pre-commit-fixes",
    "version": "1.0.3",
    "project_urls": {
        "Bug Reports": "https://github.com/OGsiji/data-contract-validator/issues",
        "Changelog": "https://github.com/OGsiji/data-contract-validator/blob/main/CHANGELOG.md",
        "Documentation": "https://github.com/OGsiji/data-contract-validator/blob/main/README.md",
        "Homepage": "https://github.com/OGsiji/data-contract-validator",
        "Repository": "https://github.com/OGsiji/data-contract-validator"
    },
    "split_keywords": [
        "dbt",
        " fastapi",
        " contract-testing",
        " api-validation",
        " data-engineering",
        " schema-validation",
        " ci-cd",
        " devops"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3c0290a9ce4e04b3881ea1d0f8979cd18ced6ae0f51d1ff0569d2da6dc5d1dc7",
                "md5": "1091279fd0c64b5d7fac109897d892ed",
                "sha256": "0256b6cd57bb55ca2f4ae026ea5511084c43b9b186ebc038b64d31164b7cbcc8"
            },
            "downloads": -1,
            "filename": "data_contract_validator-1.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1091279fd0c64b5d7fac109897d892ed",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 25733,
            "upload_time": "2025-08-10T16:06:09",
            "upload_time_iso_8601": "2025-08-10T16:06:09.187012Z",
            "url": "https://files.pythonhosted.org/packages/3c/02/90a9ce4e04b3881ea1d0f8979cd18ced6ae0f51d1ff0569d2da6dc5d1dc7/data_contract_validator-1.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4058035b7f6cfd438a4711150ea45d99034b9f3e12d8369f45e7e82553c7f490",
                "md5": "db8923e4b35681438b95e35265757a7f",
                "sha256": "ec476eefe727ed36220409307598f6fe68402c1655172760c3927c6e806cc49e"
            },
            "downloads": -1,
            "filename": "data_contract_validator-1.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "db8923e4b35681438b95e35265757a7f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 27538,
            "upload_time": "2025-08-10T16:06:10",
            "upload_time_iso_8601": "2025-08-10T16:06:10.691606Z",
            "url": "https://files.pythonhosted.org/packages/40/58/035b7f6cfd438a4711150ea45d99034b9f3e12d8369f45e7e82553c7f490/data_contract_validator-1.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-10 16:06:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "OGsiji",
    "github_project": "data-contract-validator",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "pydantic",
            "specs": [
                [
                    ">=",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "PyYAML",
            "specs": [
                [
                    ">=",
                    "6.0"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.25.0"
                ]
            ]
        },
        {
            "name": "click",
            "specs": [
                [
                    ">=",
                    "8.0.0"
                ]
            ]
        }
    ],
    "lcname": "data-contract-validator"
}
        
Elapsed time: 1.49607s