# calogica/dbt-expectations architecture

> Architecture diagram of the GitHub repository calogica/dbt-expectations, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/calogica/dbt-expectations
- Repository: https://github.com/calogica/dbt-expectations

## Overview

dbt-expectations is a dbt package that lets data teams declare Great Expectations-style data quality tests and execute them in their warehouse through dbt. The main workflow is a dbt user configuring a test, dbt running the package’s SQL test macros, and the warehouse evaluating the resulting checks. The README documents broad test families and supported warehouses, but no source excerpts were supplied, so internal macro calls and helper relationships are not asserted.

Main entry points: [`macros/schema_tests/table_shape`](https://github.com/calogica/dbt-expectations/tree/main/macros/schema_tests/table_shape) (Table shape tests), [`macros/schema_tests/column_values_basic`](https://github.com/calogica/dbt-expectations/tree/main/macros/schema_tests/column_values_basic) (Basic value tests), [`macros/schema_tests/string_matching`](https://github.com/calogica/dbt-expectations/tree/main/macros/schema_tests/string_matching) (String matching), [`macros/schema_tests/aggregate_functions`](https://github.com/calogica/dbt-expectations/tree/main/macros/schema_tests/aggregate_functions) (Aggregate tests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Test workflow"]
  node_dbt["dbt runtime"]
end

subgraph group_shape["Table shape"]
  node_table_shape["Table shape tests"]
end

subgraph group_values["Column values"]
  node_basic_values["Basic value tests"]
  node_string_matching["String matching"]
end

subgraph group_analytics["Analytical checks"]
  node_aggregates["Aggregate tests"]
  node_multicolumn["Multi-column tests"]
  node_distributional["Distributional tests"]
end

subgraph group_helpers["SQL helpers"]
  node_generalized["Generalized expressions"]
  node_math["Math macros"]
  node_regex["Regex macro"]
  node_utilities["SQL utilities"]
end

node_user(("dbt user"))
node_warehouse[("Data warehouse")]

node_user -->|"configures tests"| node_dbt
node_dbt -->|"runs tests"| node_table_shape
node_dbt -->|"runs tests"| node_basic_values
node_dbt -->|"runs tests"| node_string_matching
node_dbt -->|"runs tests"| node_aggregates
node_dbt -->|"runs tests"| node_multicolumn
node_dbt -->|"runs tests"| node_distributional
node_dbt -->|"executes checks"| node_warehouse

click node_table_shape "https://github.com/calogica/dbt-expectations/tree/main/macros/schema_tests/table_shape"
click node_basic_values "https://github.com/calogica/dbt-expectations/tree/main/macros/schema_tests/column_values_basic"
click node_string_matching "https://github.com/calogica/dbt-expectations/tree/main/macros/schema_tests/string_matching"
click node_aggregates "https://github.com/calogica/dbt-expectations/tree/main/macros/schema_tests/aggregate_functions"
click node_multicolumn "https://github.com/calogica/dbt-expectations/tree/main/macros/schema_tests/multi-column"
click node_distributional "https://github.com/calogica/dbt-expectations/tree/main/macros/schema_tests/distributional"
click node_generalized "https://github.com/calogica/dbt-expectations/tree/main/macros/schema_tests/_generalized"
click node_math "https://github.com/calogica/dbt-expectations/tree/main/macros/math"
click node_regex "https://github.com/calogica/dbt-expectations/tree/main/macros/regex"
click node_utilities "https://github.com/calogica/dbt-expectations/tree/main/macros/utils"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dbt,node_user toneBlue
class node_table_shape,node_warehouse toneAmber
class node_basic_values,node_string_matching toneMint
class node_aggregates,node_multicolumn,node_distributional toneRose
class node_generalized,node_math,node_regex,node_utilities toneIndigo
```

## Components

### Test workflow

- **dbt runtime**

### Table shape

- [Table shape tests](https://github.com/calogica/dbt-expectations/tree/main/macros/schema_tests/table_shape): `macros/schema_tests/table_shape`

### Column values

- [Basic value tests](https://github.com/calogica/dbt-expectations/tree/main/macros/schema_tests/column_values_basic): `macros/schema_tests/column_values_basic`
- [String matching](https://github.com/calogica/dbt-expectations/tree/main/macros/schema_tests/string_matching): `macros/schema_tests/string_matching`

### Analytical checks

- [Aggregate tests](https://github.com/calogica/dbt-expectations/tree/main/macros/schema_tests/aggregate_functions): `macros/schema_tests/aggregate_functions`
- [Multi-column tests](https://github.com/calogica/dbt-expectations/tree/main/macros/schema_tests/multi-column): `macros/schema_tests/multi-column`
- [Distributional tests](https://github.com/calogica/dbt-expectations/tree/main/macros/schema_tests/distributional): `macros/schema_tests/distributional`

### SQL helpers

- [Generalized expressions](https://github.com/calogica/dbt-expectations/tree/main/macros/schema_tests/_generalized): `macros/schema_tests/_generalized`
- [Math macros](https://github.com/calogica/dbt-expectations/tree/main/macros/math): `macros/math`
- [Regex macro](https://github.com/calogica/dbt-expectations/tree/main/macros/regex): `macros/regex`
- [SQL utilities](https://github.com/calogica/dbt-expectations/tree/main/macros/utils): `macros/utils`

### Other components

- **dbt user**
- **Data warehouse**

## Connections

- dbt user → dbt runtime: configures tests (evidence: `README.md`)
- dbt runtime → Table shape tests: runs tests (evidence: `README.md`)
- dbt runtime → Basic value tests: runs tests (evidence: `README.md`)
- dbt runtime → String matching: runs tests (evidence: `README.md`)
- dbt runtime → Aggregate tests: runs tests (evidence: `README.md`)
- dbt runtime → Multi-column tests: runs tests (evidence: `README.md`)
- dbt runtime → Distributional tests: runs tests (evidence: `README.md`)
- dbt runtime → Data warehouse: executes checks (evidence: `README.md`)
