Can I exclude views instead of include them?

Knowledge Drop

Last tested: March 21, 2021

In general, it's best practice to include files rather than exclude files. If you have a good naming system, you can do things like:

include: "sales.*.view.lkml"include: "users.*.view.lkml"

This is more clear and will speed up the LookML Validator since you're only including files that are needed. See our Help Center article on best practices for performance.

Workaround for Excluding Files: Glob Exclusion

There is a workaround using the glob syntax, you can write:

include: "[!s]*.view.lkml"explore: games {}explore: sales {}

In the above "!" doesn't mean "exclude", it means "include everything but" files that begin with "s., this would include the games view but not sales. If include: "*.view.lkml" was also present sales would still be included.

IMPORTANT NOTE: include: "[!orders]*.view.lkml" would not "include everything but files that begin with order" it  is actually including all the view files that do not begin with "o", "r","d","e","r", and "s" as individual characters.

Thus the workaround is to append an unusual character (or a capital letter - glob is case sensitive!) to the desired filenames in order to exclude them with the available glob syntax.

This content is subject to limited support.                

Version history
Last update:
‎04-05-2021 09:13 AM
Updated by: