Prerequisites
- AnomalyArmor account with connected data source
- dbt project configured
- Python 3.9+ (for SDK) or shell access (for CLI)
- API key with
read-onlyscope (orread-writefor triggering checks)
Installation
Pattern 1: Pre-run Quality Gate
Check data quality before running dbt:Using CLI (Shell Script)
Using Python
Pattern 2: Post-run Validation
Validate output quality after dbt completes:Pattern 3: dbt run-operation Hook
Create a dbt macro that calls AnomalyArmor:The
shell() function is not a built-in dbt Jinja function. This pattern requires a custom macro
or package that provides shell execution capabilities. Consider using the wrapper script approach
(Pattern 4) for a simpler, more portable solution.Pattern 4: Full dbt Wrapper Script
A wrapper that handles pre-checks, dbt run, and post-validation:Pattern 5: dbt Cloud Webhook Integration
For dbt Cloud, use webhooks to trigger AnomalyArmor checks:Pattern 6: Upload Lineage from dbt
Upload your dbtmanifest.json to populate data lineage in AnomalyArmor. This lets you visualize the full DAG, run impact analysis, and check upstream freshness before transformations.
Best Practices
1. Scope Your Checks
Don’t check everything. Focus on critical paths:2. Set Appropriate Thresholds
Configure checks with realistic thresholds:3. Fail Fast, But Not Always
4. Cache API Calls
For large dbt projects, minimize API calls:Troubleshooting
”Asset not found” errors
Ensure your table names match AnomalyArmor’s qualified names exactly:Slow checks
For faster feedback, use summary endpoints instead of individual checks:Next Steps
Common Questions
Do I replace my dbt tests with AnomalyArmor, or run both?
Run both - they do different things. dbt tests validate model-level contracts at build time (is this column unique? are these values in this set?). AnomalyArmor monitors continuously after dbt runs, catching freshness violations, schema drift, and statistical anomalies that point-in-time tests miss. See migrating from dbt tests for the patterns.Does AnomalyArmor hook into dbt run or does it monitor tables after the fact?
Both patterns work. For post-run monitoring, nothing to configure - AnomalyArmor watches your warehouse independently. For pre-run gating (fail fast if source data isn’t fresh enough), add a Python/shell step before dbt run that calls the AnomalyArmor freshness API. See the “Pre-run gating” section above.
Can AnomalyArmor import my existing dbt tests instead of rewriting them?
Yes. Usearmor migrate-from dbt path/to/dbt/project (available via the AnomalyArmor CLI) to generate ODCS contract files from your dbt schema.yml. Tests like not_null, unique, accepted_values, and relationships map cleanly; others surface as warnings. See migrating from dbt.
Does the integration work with dbt Cloud as well as dbt Core?
Yes. dbt Cloud emitsmanifest.json on every run; configure AnomalyArmor to consume it via the lineage-upload flow, and model-to-table relationships populate automatically. See lineage upload.
GitHub Actions
Run checks in CI/CD
Airflow Integration
Orchestrate with Airflow
Validity API
Full validity API reference
Metrics API
Track data metrics
