Unit tests with dbt refs
SQLBuild unit tests can mock dbt model dependencies using__dbt_ref__ fixture CTEs. When a model has a package, use __dbt_ref__package__model. When there is no package, use __dbt_ref__model:
analytics.fact_orders with controlled data, allowing you to test your SQLBuild model without a warehouse connection or a compiled dbt manifest.
sqb dbt test
sqb dbt test runs dbt tests first, then SQLBuild’s validations for the selected models:
- dbt test runs first - with the user’s original selectors
- SQLBuild test runs - unit tests for selected SQLBuild models
- SQLBuild audit runs - audits for selected SQLBuild models
test_type:data and test_type:unit selectors are mapped to SQLBuild equivalents: test_type:data runs SQLBuild audits, test_type:unit runs SQLBuild unit tests. Without a test type selector, both run.
sqb dbt debug
sqb dbt debug runs both dbt’s and SQLBuild’s diagnostics:
dbt debug (verifying dbt project config and warehouse connection) followed by sqb debug (verifying SQLBuild project config and connection).
