Elementary dbt package includes exposure validation tests, implemented as dbt tests.
These tests can detect changes in your models’ columns that break downstream exposures, such as BI dashboards.
Adding the Elementary exposure tests for your module
For each module schema you wish to verify the exposure dependencies, add the elementary exposure tests:
... - name: returned_orders description: This table contains all of the returned orders config: tags: ["finance"] data_tests: - elementary.volume_anomalies: config: tags: ["table_anomalies"] arguments: timestamp_column: "order_date" - elementary.exposure_schema_validity: config: tags: [elementary]
We recommend adding a tag to the tests so you can execute these in a dedicated run using the selection parameter --select tag:elementary.Upon running the tests, if breaking changes are detected in the model, the test will fail and in the test result query you’ll be able to see the reasons:
SELECT 'customers' as exposure, 'https://your.bi.tool/dashboards/1' as url, 'different data type for the column customer_id numeric vs numeric' as errorUNION ALL SELECT 'customers' as exposure, 'https://your.bi.tool/dashboards/1' as url, 'order_id column missing in the model' as error
When a test fails, it means that an exposure is potentially broken due to a missing or wrongly-typed column. Open your BI tool to validate, and if you make any changes to your dashboards be sure to update the exposures.yml and your model schema accordingly.