Skip to main content

Getting Started

What you'll achieve

By the end of this tutorial, you'll be able to use Spectacles to check the validity of the SQL defined in the dimensions of your Looker project.

Before you begin

You'll need to give Spectacles a Looker API key so it can run tests. Follow this guide for our recommendations on how to set up an API key for Spectacles.

When you're done, you should have a client ID and client secret that look something like this:

Client ID: 4x2vgxNvCD3RYDM05gna
Client Secret: KDDwdDMm8MXyrJNqXBchbdmY

Create a Suite

A Suite is a set of instructions that Spectacles follows to run tests on your Looker instance. Among other things, Suites determine:

  • How Spectacles runs are triggered (manually, on a schedule, or on pull requests)
  • Which types of tests are run (these are called Validators)
  • Which models and explores to test
  • Notifications for errored and failed runs

For now, we'll create a simple Suite that instructs Spectacles to run SQL validation against our instance every day at 6 AM.

  1. In the top menu, click Suites.
  2. Click New Suite.

There are a lot of options on the Suite page, but we'll focus on a small section of it for now.

  1. Name your Suite "SQL Validation"

  2. Configure the Triggers section to schedule the Suite to run at 6:00 UTC each day.

  3. Configure the SQL Validator section with the following options:

    • Explores to query: your_model/your_explore
    • Explores to exclude: Leave the default
    • Fail fast: Yes
    • Query concurrency: Leave the default
  4. Uncheck Is Enabled for the Content Validator and the Assert Validator. We'll come back to these validators in a later tutorial.

  5. Click Create Suite.

note

The Explores to query and Explores to exclude options accept a comma-separated list of model and explore pairs. You can use a wildcard character * to select all explores within a model or all models and explores (*/*).

Here are some examples:

Only Explore A

model_a/explore_a

All explores in Model A

model_a/*

Every explore named Explore A across all models

*/explore_a

Explore A and Explore B

model_a/explore_a, model_a/explore_b

Run the suite

You're ready for the final step! To run the SQL Validator, click Run next to your Suite.

Spectacles will run SQL validation against the production branch of your project. In Looker in Admin > Queries, you should be able to see Spectacles running queries as your user.

Congratulations! If Spectacles identified any SQL errors in your explore, try fixing them and re-running the validator.