Skip to main content

Overview: Testing dbt Changes

If you're using dbt to create the tables and views that Looker depends on, it's very easy to make a change to your dbt models that will cause errors in Looker. Fortunately, Spectacles can help you catch these errors before they are deployed to production.

With the right setup, you can use Spectacles to test the impact of dbt changes in Looker. Spectacles will tell you if your dbt changes are going to break anything in Looker before you merge them.

For example, Spectacles might detect a schema change in a model that would break a key dashboard without a corresponding LookML change.

Setting this up requires a bit of configuration in dbt, Looker, and Spectacles, but we've written a series of guides that will help you start testing your dbt changes without hassle. Read on for links for each step.

Getting Started

Here's what you need to do:

  1. Implement CI/CD for dbt. We wrote a guide describing some common options for doing this.

  2. Prepare your LookML for dbt testing. You'll need to replace your data warehouse schema references in SQL fields (sql_table_name, derived tables, etc.) with dynamic user attributes so Spectacles can control which data Looker points to.

  3. Add the schema user attributes to Spectacles. If you haven't added user attributes to Spectacles, here's how.

  4. Trigger Spectacles runs on dbt changes. If you're using dbt Cloud and GitHub, use this guide on dbt Cloud, otherwise use our guide for dbt CLI.