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
extends (for Views)

This page refers to the extends parameter that is part of a view.

extends can also be used as part of an Explore, as described on this documentation page.

extends can also be used as part of a LookML dashboard, as described on this documentation page.

Usage

view: view_name {
  extends: [view_name, view_name, …]
}

Hierarchy

extends

Default Value

None

Accepts

Square brackets containing a comma-separated list of view names

Definition

The extends parameter allows you to build upon the content and settings from another view file, using the other view file as a starting point. If there are any conflicts, the extending view will use its own settings, overriding the settings of the view being extended. See Reusing Code with Extends for the details of how Looker does this.

Check out LookML refinements.

Extending a view or an Explore is ideal for scenarios where you want to have multiple versions of the view or Explore. But if your goal is simply to modify a view or an Explore without editing the LookML file that contains it, you may want to use a refinement instead.

You can also use an extends parameter inside a refinement.

See the LookML Refinements documentation page for more information and use cases.

When extending a view, it’s important to use the sql_table_name parameter on the view that is going to be extended, if it’s not already there. The sql_table_name parameter defines the table in your database that will be queried by a view. For any view the default value is the name of the view. So, if you aren’t already using sql_table_name, simply give it the same value as your view name.

It’s also important that in our new view file we use the include parameter to point to the filename of the view we want to extend.

Avoid extending views that are based on persistent derived tables (PDTs). Each extension of a PDT will create a new copy of the table in your database. In this case, you may want to use LookML refinements instead. See the LookML Refinements documentation page for more information and use cases.

Example

Here’s an example view file that we can extend. The view is named looker_events and the view’s filename is events.view.

File: events.view

view: looker_events { sql_table_name: looker_db.events ;; # The normal contents of the view follow }

Now we’ll create a new view file and define a view that extends the looker_events view. In our new file, we must use the include parameter to point to the file name of the view we want to extend:

File: new_events.view

include: "events.view" view: name_of_the_new_view { extends: [looker_events]   measure: additional_measure { type: count } # Additional things you want to add or change }

And then we’ve added a new measure that will show in our new view in addition to all the dimensions and measures that are defined in the looker_events view that we extended.

Things to Consider

When extending an object, be aware that localization rules apply to your extensions as well. If you are extending an object and then defining new labels or descriptions, you should provide localization definitions in your project’s locale strings files. See the Localizing Your LookML Model documentation page for more information.

Top