Data test previews
Test your data in the pull request
Never merge a data breaking change again with data test previews. Metaplane will test the data in your development branch against production data in seconds, giving your team peace of mind when reviewing and merging pull requests.
Easily configure tests
Metaplane always comes with great defaults and flexibility. Data test previews are configurable so you can choose which tests are run and adjust testing thresholds.
Share data test reports with teammates
Share the results of data tests with stakeholders and teammates to raise awareness about data quality across the organization.
To run data test previews, Metaplane will need access to the new PR schemas that your dbt CI job creates on each run. There two primary ways to accomplish this:
A) Grant the Metaplane user access to all future schemas on the specific warehouse database where dbt is running.
B) Add a step in the CI job in dbt to selectively grant the Metaplane user access to the newly created schema. Our friends at SpotOn created this helpful macro to grant access to the newly created schemas. This can be adapted and run in your project via dbt run-operation command.
Gain more control over how Metaplane runs your test by specifying additional configuration in your dbt model's metadata section. Below is an annotated example of the currently supported options.
- name: payments meta: metaplane: testPreviews: # optional custom sql expression(s) to limit the # data tested on both staging and production version of this model sqlWhereClause: "payment_id > 20 AND created_at > dateadd('day', -5, current_timestamp)" # optional, defaults to true. Set to false to turn off test previews for this model isEnabled: true
sqlWhereClause is useful to limit what data we look at to either improve test runtime on large tables or to ensure that the range of data being queried matches on both staging and production.
The error message
Unable to find Tables and Columns is one of most common reason we are not able to run tests. Metaplane attempts to find the table + column for each changed model both from the normal warehouse path as well as in the newly created dbt_pr schema. This message typical comes from us being unable to find the table on the dbt_pr schema.
- Ensure Metaplane has been granted read permissions for the dbt_pr schemas (see Configuration above)
- Automation like SlimCI will prevent unchanged models from being built in each PR. This can prevent the model from existing on the dbt_pr schema even when we have access.
- A net new model doesn't yet have a comparison point, so we can't test it.
- If none of the above are true, and the model appears in both the warehouse and the dbt_pr schema, please reach out for support.
Updated 22 days ago
Get started by connecting your dbt Cloud repo in Github to Metaplane: