<@U088WCP3B4P> Hello, for the test elementary.all_...
# ask-elementary-ai
a
@kapa.ai Hello, for the test elementary.all_columns_anomalies, is it possible to exclude some columns ? Like if i have 20 columns and there's 1 where i don't want to run this test, how can i do it ?
k
A message from kapa.ai
Yes, you can exclude columns from
elementary.all_columns_anomalies
. There are two test-level parameters you can use: 1.
exclude_prefix
– exclude all columns whose name starts with a given prefix (only one prefix is supported, and under the hood it’s converted to a regex). Example:
Copy code
yml    models:      - name: my_model        tests:          - elementary.all_columns_anomalies:              exclude_prefix: "id_"
This will skip columns like
id_user
,
id_order
, etc. [[exclude_prefix](https://docs.elementary-data.com/data-tests/anomaly-detection-configuration/exclude_prefix); [all_columns_anomalies](https://docs.elementary-data.com/data-tests/anomaly-detection-tests/all-columns-anomalies)] 2.
exclude_regexp
– exclude columns whose name matches a regular expression, which is useful for one or multiple specific columns:
Copy code
yml    models:      - name: my_model        tests:          - elementary.all_columns_anomalies:              exclude_regexp: "^(column_to_skip)$"
Or multiple columns:
Copy code
yml    exclude_regexp: "^(column_to_skip|another_column_to_skip)$"
[[exclude_regexp](https://docs.elementary-data.com/data-tests/anomaly-detection-configuration/exclude_regexp); [Slack example](https://slack.com/archives/C02CTC89LAX/p1650985870725969)] These parameters apply only to the
all_columns_anomalies
test and let you keep the test on the table while skipping one or more specific columns.
a
@kapa.ai Ah i kinda have annoying names there. I want to exclude those columns : • sale_pur_last_15m • sale_pur_last_30m • sale_pur_last_1h But i have other columns named for example : • sale_pur_last_8h • sale_pur_last_12h • sale_pur_last_16h How can i do it cleanly then ?
k
A message from kapa.ai
You’ll want to use
exclude_regexp
on the
elementary.all_columns_anomalies
test and match only those three column names. For your case:
Copy code
yml models:   - name: your_model_name     tests:       - elementary.all_columns_anomalies:           exclude_regexp: "^(sale_pur_last_15m|sale_pur_last_30m|sale_pur_last_1h)$"
This regex matches exactly those three columns and will not match
sale_pur_last_8h
,
sale_pur_last_12h
, etc. [[exclude_regexp](https://docs.elementary-data.com/data-tests/anomaly-detection-configuration/exclude_regexp); [Slack exclude examples](https://slack.com/archives/C02CTC89LAX/p1650985870725969)]