User Guide Getting Started Help Center Documentation Community Training
View Parameters

A view represents a table of data in Looker, whether that table is native to your database or was created using Looker’s derived table functionality. Views are typically declared in view files, with one view per file.

Within each view are field definitions, each of which typically corresponds to a column in the underlying table or a calculation in Looker. These fields are described in the field reference, dimension type reference, and measure type reference.

There are also a number of view-level settings, which are described on this page.

Example Usage

Hover over a parameter name to see a quick description; click it to jump to that page.
When a parameter can be set to one of several specific options, the default value is listed first.

include: "filename_or_pattern"
# Possibly more include declarations

test: test_name {
  explore_source: explore_name {
    # Desired subparameters (described on test page)
  assert: assert_statement {
    expression: Looker expression ;;
  # Possibly more assert declarations
# Possibly more test declarations

view: view_name {
  extension: required
  extends: [view_name, view_name,]
  (dimension | dimension_group | measure | filter): field_name {
    # Desired field parameters (described on Field Parameters page)
  # Possibly more field declarations

  set: set_name {
    fields: [field_or_set, field_or_set,]
  # Possibly more set declarations

  drill_fields: [field_or_set, field_or_set,]

  label: "desired label"

  suggestions: yes | no

  required_access_grants: [access_grant_name, access_grant_name, …]
  sql_table_name: table_name ;;

  derived_table: {
    cluster_keys: ["column_name", "column_name",]
    create_process: {
      sql_step: SQL query ;;
    datagroup_trigger: datagroup_name
    distribution: "column_name"
    distribution_style: all | even
    explore_source: explore_name {
      # Desired subparameters (described on explore_source page)
    indexes: ["column_name", "column_name",]
    partition_keys: ["column_name", "column_name",]
    persist_for: "N (seconds | minutes | hours)"
    publish_as_db_view: yes | no
    sortkeys: ["column_name", "column_name",]
    sql: SQL query ;;
    sql_create: {
      SQL query ;;
    sql_trigger_value: SQL query ;;

Parameter Definitions

Parameter Name Description
Structural Parameters
drill_fields (for view) Specify the default list of fields shown when drilling into measures defined in the view
extends (for view) Specify view(s) that will be extended by this view.
extension (for view) Specify that the view requires extension and cannot itself be exposed to users.
include Add files to a view.
test ADDED6.20 Creates a data test to verify your model’s logic. The project settings include an option to require data tests. When this is enabled for a project, developers on the project must run data tests before deploying their changes to production. This parameter has explore_source and assert subparameters.
set Define a set of dimensions and measures to be used in other parameters.
view Create a view.
Display Parameters
label (for view) Specify how the view name will appear in the field picker.
Filter Parameters
suggestions (for view) Enable or disable suggestions for all dimensions on this view.
Query Parameters
required_access_grants (for view) ADDED6.0 Limit access to the view to only users whose user attribute values match the access grants.
sql_table_name (for view) Change the SQL table on which a view is based.
Derived Table Parameters
cluster_keys ADDED6.0 Specify that a persistent derived table be clustered by one or more fields in BigQuery.
create_process ADDED5.16 Specify an ordered sequence of steps to create a PDT on a database dialect that requires custom DDL commands. This parameter has the subparameter sql_step.
datagroup_trigger Specify the datagroup to use for the PDT rebuilding policy.
derived_table Base a view on a derived table.
distribution Set the distribution key of a persistent derived table that is built in Redshift or Aster.
distribution_style Set the distribution style of a persistent derived table that is built in Redshift.
explore_source Define a native derived table based on an Explore.
indexes Set the indexes of a persistent derived table built in a traditional database (e.g. MySQL, Postgres) or an interleaved sort key in Redshift.
partition_keys Specify that a persistent derived table be partitioned by one or more fields in Presto, or by a single date/time field in BigQuery.
persist_for (for derived_table) Set the maximum age of a persistent derived table before it is regenerated.
publish_as_db_view ADDED7.0 Create a stable database view for the PDT to enable querying the table outside of Looker.
sortkeys Set the sort keys of a persistent derived table that is built in Redshift.
sql (for derived_table) Declare the SQL query for a derived table.
sql_create ADDED5.16 Define a SQL CREATE statement to create a PDT on a database dialect that requires custom DDL commands.
sql_trigger_value Specify the condition that causes a persistent derived table to be regenerated.
Parameters to Avoid
distkey REMOVED3.26 Replaced by distribution.
view_label AVOID4.4 Replaced by label.