Skip to main content

Content Validator

Usage

spectacles content
[-h]
[GLOBAL_FLAGS ...]
--project PROJECT
[--branch BRANCH]
[--remote-reset | --commit-ref COMMIT_REF]
[--explores EXPLORES [EXPLORES ...]]
[--folders FOLDERS [FOLDERS ...]]
[--incremental]
[--exclude-personal]

Options

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

branch

Usage: --branch dev-branch-abc123

The Git branch of your Looker project to validate.

If neither branch nor commit-ref are passed, Spectacles will test production.

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.

If neither branch nor commit-ref are passed, Spectacles will test production.

Environment Variable: SPECTACLES_COMMIT_REF

folders

Usage: --folders 248 19 101

The ID of any content folders that Spectacles should specifically include in validation. Spectacles will also include all content in subfolders. By default, Spectacles includes all folders in validation.

To obtain the ID of folders from the Looker IDE, navigate to the desired folder and look at the URL. For example, the URL https://spectacles.looker.com/folders/8 corresponds to folder ID 8.

To exclude a specific folder, add a leading hyphen. For example, -245 will exclude the folder ID 245 from validation.

If folders are selected and excluded (for example, excluding a sub-folder while including its parent), exclusion takes precedence for the excluded folders and for all subfolders.

exclude-personal

Usage: --exclude-personal

Ignore all errors identified in content that lives in personal folders. Personal folders are individual user folders rather than folders in the Shared folder. Provide this flag if you aren't concerned with user-specific content, e.g. because it is historical or experimental.

explores

Usage: --explores model_a/* -model_a/explore_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.

To exclude a model or explore, add a leading hyphen. For example, -orders/order_items will exclude the order_items Explore from validation.

Here are some additional examples:

Only Explore A

--explores model_a/explore_a

All Explores except for Explore B

--explores -model_a/explore_b

All Explores in Model A except for Explore B

--explores "model_a/*" -model_a/explore_b

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
tip

On some shells, like zsh, the * character gets treated as a file globbing wildcard, with causes unexpected results for Spectacles. You might see an output like:

zsh: no matches found

If that happens, you need to wrap your model_name/explore_name strings in quotes, like --explores "model_a/explore_a".

incremental

Usage: --incremental

Spectacles will run content validation twice, once on the specified branch and once in production. Spectacles will only display content errors that are found on the specified branch but not in production. If no branch is provided, Spectacles runs as if this flag was not provided.

This is useful in cases where you only want to identify content errors introduced by the changes on the specified branch.

pin-imports

Usage: --pin-imports core_looker_project:ae4d8c

Pins locally imported Looker projects to a specific git ref. By default, Spectacles will set any locally imported Looker projects, defined in your manifest.lkml, to their current production commit. If you want to test a project with a specific commit or branch from the upstream imported project, you can use this flag to do so.

project

Required. Usage: --project ecommerce

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

Unlike the Looker Content Validator, the Spectacles Content Validator only returns errors caused by models and explores in the specified project.

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