@batman_007 . You can create generic test and attach into source table.
for Eg:
-
Create generic folder under test and write your test SQL model.
tests/generic/data_count_check.sql -
data_count_check.sql
{% test data_count_check(model, threshold) %} SELECT COUNT(*) AS raw_record_count FROM {{ model }} HAVING raw_record_count> {{threshold}}
-
schema.yml file
version: 2 sources: - name: raw_customer tables: - name: customer tests: - data_count_check: tags: - data_count_dq_check severity: warn threshold: 5
-
dbt test --select tag:data_count_dq_check
Hope this helps !!