home User Guide Getting Started Help Center Documentation Community Training Certification
menu
close
settings
Looker keyboard_arrow_down
language keyboard_arrow_down
English
Français
Deutsch
日本語
search
print
Looker documentation will be moving to cloud.google.com in mid-2022!
All the information you rely on will be migrated and all docs.looker.com URLs will be redirected to the appropriate page.
view_name

Usage

explore: explore_name {
  view_name: view_name
}
Hierarchy
view_name
Default Value
A view whose name matches the Explore’s name

Accepts
The name of an existing view

Definition

view_name determines the view that will define the fields of an Explore. If view_name is omitted, Looker assumes that the underlying view name is the same as the Explore name. Typically view_name is only used to create multiple Explores from the same view.

Examples

Add an option to the Explore menu called Customer based on the view called user:

explore: customer { view_name: user }

Common challenges

view_name, from, and label are often confused but have different behaviors

view_name, from and label parameters have similar, but different effects.

Using view_name

Use view_name to create multiple Explores from the same view, and reference fields the same way for each Explore:

explore: customer { view_name: user } # Would appear in the Explore menu as "Customer" # Fields would appear like "User Name" # You would reference fields like ${user.name}   explore: buyer { view_name: user } # Would appear in the Explore menu as "Buyer" # Fields would appear like "User Name" # You would reference fields like ${user.name}

With view_name: user, the generated SQL uses the original table name, like this: FROM schema.users AS users.

Using from

Use from to create multiple Explores from the same view, and reference fields differently for each Explore:

explore: customer { from: user } # Would appear in the Explore menu as "Customer" # Fields would appear like "Customer Name" # You would reference fields like ${customer.name}   explore: buyer { from: user } # Would appear in the Explore menu as "Buyer" # Fields would appear like "Buyer Name" # You would reference fields like ${buyer.name}

With from: user, the generated SQL aliases the original table name, like this: FROM schema.users AS customer.

Using label

Use label if you don’t need to create multiple Explores from the same view, and you want the Explore’s name to appear differently in the Explore menu:

explore: user { label: "Customer" } # Would appear in the Explore menu as "Customer" # Fields would appear like "User Name" # You would reference fields like ${user.name}

Things to know

view_name is rarely used to rename an Explore

It is uncommon to use view_name to rename an Explore, unless you are creating an extended model and need to create multiple Explores from the same view.

Consider renaming the underlying view or using label to change how the Explore appears in the field picker.

Top