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 a parameter to visit its reference page. When a parameter can be set to one of several specific options, the default value is listed first.

## STRUCTURAL PARAMETERS

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, ...]

  # DISPLAY PARAMETERS

  label: "desired label"
  fields_hidden_by_default: yes | no

  # FILTER PARAMETERS

  suggestions: yes | no

  # QUERY PARAMETERS

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

  # DERIVED TABLE PARAMETERS

  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)
    }
    increment_key: "column_name"
    increment_offset: N
    indexes: ["column_name", "column_name", ...]
    interval_trigger: "N (seconds | minutes | hours)"
    materialized_view: yes | no
    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 ;;
    table_compression: GZIP | SNAPPY
    table_format: PARQUET | ORC | AVRO | JSON | TEXTFILE
  }
}

## REFINEMENT PARAMETERS
view: +view_name {
  final: yes
}

Parameter definitions

Parameter Name Description
Structural Parameters
drill_fields (for view) Specifies the default list of fields shown when drilling into measures defined in the view
extends (for view) Specifies view(s) that will be extended by this view
extension (for view) Specifies that the view requires extension and cannot itself be exposed to users
include Adds files to a view
test 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 Defines a set of dimensions and measures to be used in other parameters
view Creates a view
Display Parameters
label (for view) Specifies how the view name will appear in the field picker
fields_hidden_by_default ADDED 21.12 When set to yes, hides all fields in the view by default. Use the hidden: no parameter on a field to display the field.
Filter Parameters
suggestions (for view) Enables or disables suggestions for all dimensions on this view
Query Parameters
required_access_grants (for view) Limits access to the view to only users whose user attribute values match the access grants
sql_table_name (for view) Changes the SQL table on which a view is based
Derived Table Parameters
cluster_keys Specifies that a PDT be clustered by one or more fields in BigQuery

Support added for cluster_keys on Snowflake
create_process Specifies 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 Specifies the datagroup to use for the PDT rebuilding policy
derived_table Bases a view on a derived table
distribution Sets the distribution key of a PDT that is built in Redshift or Aster
distribution_style Sets the distribution style of a PDT that is built in Redshift
explore_source Defines a native derived table based on an Explore
increment_key ADDED 21.4 Makes the derived table into an incremental PDT. The increment_key specifies the time increment for which fresh data should be queried and appended to the PDT.
increment_offset ADDED 21.4 Used in conjunction with the increment_key parameter for incremental PDTs. The increment_offset specifies the number of previous time periods (at the increment key's granularity) that are rebuilt to account for late arriving data.
interval_trigger ADDED 21.20 The interval_trigger specifies a rebuild schedule for a persistent derived table, in the format "N (seconds | minutes | hours)"
materialized_view ADDED 21.10 The statement materialized_view: yes creates a materialized view on your database for a derived table.
indexes Sets the indexes of a PDT built in a traditional database (for example, MySQL, Postgres) or an interleaved sort key in Redshift
partition_keys Specifies that a PDT be partitioned by one or more fields in Presto, or by a single date/time field in BigQuery
persist_for (for derived_table) Sets the maximum age of a PDT before it is regenerated
publish_as_db_view The statement publish_as_db_view: yes creates a stable database view for the PDT to enable querying the table outside of Looker
sortkeys Sets the sort keys of a PDT that is built in Redshift
sql (for derived_table) Declares the SQL query for a derived table
sql_create Defines a SQL CREATE statement to create a PDT on a database dialect that requires custom DDL commands
sql_trigger_value Specifies the condition that causes a PDT to be regenerated
table_compression Specifies the table compression to use for a PDT in Amazon Athena
table_format Specifies the table format to use for a PDT in Amazon Athena
Refinement Parameters
view: +view_name Adds a plus sign (+) in front of an existing view name to add a refinement to the existing view. See the LookML refinements documentation page for more information and use cases.
final Indicates that the current refinement is the final refinement allowed for the view. See the LookML refinements documentation page for more information and use cases.
Parameters to Avoid
distkey REMOVED 3.26 Replaced by distribution
view_label AVOID 4.4 Replaced by label