User Guide Getting Started Help Center Documentation Community Training
New LookML
Old LookML
New LookML
Looker
  
English
Français
Deutsch
日本語
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 will assume that the underlying view name is the same as the Explore name. Typically view_name is only used if you need 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

In addition to view_name, there is also a from parameter and a label parameter that have similar, but different effects.

Using view_name

You should use view_name if you want to create multiple Explores from the same view, and you want to 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}

The underlying reason for this behavior is that with view_name: user, the generated SQL uses the original table name, like this: FROM schema.users AS users.

Using from

You should use from if you want to create multiple Explores from the same view, and you want to 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}

The underlying reason for this behavior is that with from: user, the generated SQL aliases the original table name, like this: FROM schema.users AS customer.

Using label

You should use label if you don’t need to create multiple Explores from the same view, and you just 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’s not very common to use view_name to rename an Explore, unless you happen to be creating an extended model and need to create multiple Explores from the same view.

Otherwise, consider renaming the underlying view or using label to change how the Explore appears in the Field Picker.

Top