SQL Validator

Usage

spectacles sql
[-h]
[GLOBAL_FLAGS ...]
--project PROJECT
--branch BRANCH
[--import-projects]
[--remote-reset | --commit-ref COMMIT_REF]
[--explores EXPLORES [EXPLORES ...]]
[--exclude EXCLUDE [EXCLUDE ...]]
[--mode {batch,single,hybrid}]
[--concurrency CONCURRENCY]

Options

All required options in Global Flags are also required for the SQL Validator.

branch

Required. Usage: --branch master

The Git branch of your Looker project to validate.

Environment Variable: LOOKER_GIT_BRANCH

commit-ref

Usage: --commit-ref ae4d8c

The commit of your project that Spectacles should checkout to validate. Spectacles will create a temporary branch for the tests based on this commit and delete the branch at the end of the validation or if an exception is handled.

Environment Variable: SPECTACLES_COMMIT_REF

concurrency

Usage: --concurrency 40

The number of simultaneous queries that Spectacles will run through Looker. The default concurrency is 10. Increasing concurrency will decrease the duration of SQL validations but will increase the load on your data warehouse and Looker instance.

Most modern data warehouses can readily handle a greater query concurrency than 10, but we conservatively set the default.

exclude

Usage: --exclude model_a/explore_a model_b/*

Exclude specific models or explores from validation. This flag accepts a list of / delimited model and explore names. The wildcard operator * is also accepted to exclude all models or explores, for example model_a/* will exclude all explores in Model A.

Here's an example:

All explores except for Explore B

--exclude model_a/explore_b

explores

Usage: --explores model_a/explore_a model_b/*

Select specific models or explores for validation. This flag accepts a list of / delimited model and explore names. The wildcard operator * is also accepted to choose all models or explores, for example model_a/* will select all explores in Model A.

Here are some additional examples:

Only Explore A

--explores model_a/explore_a

All explores in Model A

--explores model_a/*

Every explore named Explore A across all models

--explores */explore_a

Explore A and Explore B

--explores model_a/explore_a model_a/explore_b

mode

Usage: --mode hybrid

One of batch, hybrid, or single. The query mode determines how Spectacles builds queries from explores. In batch mode, Spectacles will create one query per explore with all dimensions selected. In single mode, Spectacles will create one query per dimension. In hybrid mode, Spectacles will run in batch mode first, then in single mode, but only for the explores that have SQL errors.

You can read more about the tradeoffs of these query modes here.

import-projects

Usage: --import-projects

Create temporary branches based off of master for any project that is a dependency of the current project (as indicated in the project's manifest file). These branches are deleted at the end of the validation or if an exception is handled. You should only set this to true if there is a manifest.lkml file in your project.

If this flag is not set, Spectacles will use whatever branch was last used in development mode on each dependent project by the user.

Environment Variable: SPECTACLES_IMPORT_PROJECTS

project

Required. Usage: --project ecommerce

The LookML project you want to validate. Projects are listed at the bottom of the Develop menu in Looker.

Environment Variable: LOOKER_PROJECT

remote-reset

Usage: --remote-reset

Reset the branch to the version of the branch that is on the remote repository. This flag cannot be used with --commit-ref because it implicitly specifies a commit to use.

caution

Providing this flag will delete any uncommited changes in the user’s workspace.

Environment Variable: SPECTACLES_REMOTE_RESET