I’m excited to announce the official launch of Spectacles, the first continuous integration and automated testing tool for Looker.
Spectacles automatically tests your LookML and content, ensuring Looker stays reliable and accurate for your business.
Spectacles is composed of validators which run different checks against your Looker instance. Here's how Spectacles gives you peace of mind when you deploy LookML:
- Test the
sqlfield of each dimension for SQL errors
- Content validation on what matters - test for errors in content, but ignore personal space content or show only incremental errors
- Leverage data tests to validate key metrics
Spectacles is available as an open-source, command line interface (more on this below), or as a web application (check out our 2m intro video).
Spectacles at the command line
At its core, Spectacles is available as an open-source, command-line interface (CLI) for validating your Looker instance. You can check out the CLI on GitHub here, and our Getting Started tutorial here.
Once you install Spectacles and provide API credentials, here’s how you would check the dimensions in an explore for SQL errors:
spectacles sql \
--config-file config.yaml \
--branch my-dev-branch \
--project eye_exam \
If your explore is free of SQL errors, you'll see something that looks like this:
======== Testing 1 explore [batch mode] [concurrency = 10] =========
Completed SQL validation in 2 seconds.
Otherwise, you’ll get the error message(s) returned from your data warehouse, like this:
========================== thelook/sessions ==========================
The Snowflake database encountered an error while running this query.
derived_table user_order_facts creation failed: SQL Error in CREATE TABLE as
SELECT: SQL compilation error: error line 5 at position 14 invalid identifier
Test SQL: logs/queries/thelook__sessions.sql
In addition to the SQL validator, you can run enhanced content validation and data tests via Spectacles with a single command.
Check out our docs for more info on these other validators.
Spectacles for the whole team - continuous integration and beyond
The CLI is awesome for a single developer who’s comfortable enough with the command line to pip install and run Spectacles.
However, it doesn’t work very well in a continuous integration setup because it relies on a single API credential. Since a Looker user can’t be on multiple Git branches at the same time, there’s no good way to run multiple Spectacles validations simultaneously. This means it’s possible to get false positives or false negatives if two people are using Spectacles at the same time.
With this limitation in mind, we built a web version of Spectacles (website) (docs) that solves this issue and easily integrates with version control solutions like GitHub and GitLab so you can run Spectacles tests against pull requests, on schedules, and more.
Check out our website and get in touch for a demo of how Spectacles can increase the confidence, speed, and quality of your team’s LookML development!