Development
May 26, 2021

Synchronizing Looker and dbt with Spectacles

Headshot of Spectacles co-founder Josh Temple
Josh Temple
Co-Founder, Spectacles
The Spectacles logo and the dbt logo.

I’m excited to announce that, as of today, Spectacles integrates with dbt. You can connect Spectacles to your dbt project to test for SQL errors in Looker caused by proposed changes to your models. For example, if your data engineering team wants to modify the schema of a model, Spectacles will test your LookML for SQL errors introduced by that change before it goes live.

We’re thrilled to announce this integration, because dbt is in the DNA of Spectacles. I met my co-founder Josh Temple through the dbt community over 3 years ago. Our love of testing in dbt inspired us to build the first version of Spectacles. We know this integration will save data teams time by keeping Looker and dbt in sync.

The problem

We set out to fix a common problem: every time a developer opens a dbt pull request, they have no way of knowing the downstream impact of their change in Looker. If they’ve renamed a column, dropped a model, altered a data type, or changed the logic behind a model, they could be causing unhandled SQL errors in Looker without knowing it.

This is a terrible experience for the dbt developer, who has to manually check the LookML for potential inconsistencies, and for the Looker user, who encounters an unexpected SQL error in a dashboard or Explore.

The solution

With Spectacles, you can run tests against dbt pull requests to warn you of any impending errors in Looker before you merge your dbt changes. In practice, it looks like this:

  1. When a dbt pull request is opened, dbt builds the changes in a schema or database specific to the PR.
  2. Through user attributes, Spectacles instructs Looker to query the corresponding schema or database. 
  3. Spectacles checks for SQL or data test errors in Looker as a result of the dbt pull request.
  4. Spectacles displays the results on your dbt pull request so the dbt developer is aware of the impact of their change.

The solution works with both dbt Cloud and self-managed dbt pipelines. If you’re using dbt Cloud, it’s as simple as telling us where your dbt repo lives and the job ID of your CI job in dbt Cloud.

If you’re using CircleCI, GitHub Actions, or some other CI platform, it’s as simple as making two API calls to Spectacles: one to create the run and the other to get the result.

Watch our demo below to see how easy it is to set up Spectacles with dbt Cloud:

If you’re already a Spectacles customer, you can set up the dbt Cloud integration today. Check out our setup docs for step-by-step instructions.

If not, leave us your name and email below, and we’ll find some time for a 45m demo and onboarding. We'd love to show you this feature and get you started on a 14-day free trial of Spectacles.