<@U08V4MVT2QM> how to Define `test_null_count ?`
# ask-elementary-ai
n
@Wale Olaitan how to Define
test_null_count ?
k
A message from kapa.ai
To define a test for
null_count
in Elementary, you can use either the
elementary.column_anomalies
or
elementary.all_columns_anomalies
test in your dbt model's YAML file. The
null_count
monitor checks for the number of null values in a column. Example using
elementary.column_anomalies
on a specific column:
Copy code
yaml models:   - name: your_model_name     columns:       - name: your_column_name         tests:           - elementary.column_anomalies:               column_anomalies:                 - null_count
Example using
elementary.all_columns_anomalies
for all columns in a model:
Copy code
yaml models:   - name: your_model_name     tests:       - elementary.all_columns_anomalies:           column_anomalies:             - null_count
You can also specify a
timestamp_column
at the model level if you want the test to be evaluated over time buckets (e.g., daily):
Copy code
yaml models:   - name: your_model_name     config:       elementary:         timestamp_column: your_timestamp_column     columns:       - name: your_column_name         tests:           - elementary.column_anomalies:               column_anomalies:                 - null_count
The
null_count
monitor is supported for any column type and can be combined with other monitors as needed. For more details and configuration options, see the official documentation on [column anomalies](https://docs.elementary-data.com/data-tests/anomaly-detection-tests/column-anomalies) and [all columns anomalies](https://docs.elementary-data.com/data-tests/anomaly-detection-tests/all-columns-anomalies) tests.