home User Guide Getting Started Help Center Documentation Community Training Certification
Looker keyboard_arrow_down
language keyboard_arrow_down
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 ;;

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 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 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
Filter Parameters
suggestions (for view) Enables or disables suggestions for all dimensions on this view
Query Parameters
required_access_grants (for view) ADDED6.0 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 ADDED6.0 Specifies that a persistent derived table be clustered by one or more fields in BigQuery
ADDED7.6 Support added for cluster_keys on Snowflake
create_process ADDED5.16 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 persistent derived table that is built in Redshift or Aster
distribution_style Sets the distribution style of a persistent derived table that is built in Redshift
explore_source Defines a native derived table based on an Explore
indexes Sets the indexes of a persistent derived table built in a traditional database (for example, MySQL, Postgres) or an interleaved sort key in Redshift
partition_keys Specifies 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) Sets the maximum age of a persistent derived table before it is regenerated
publish_as_db_view ADDED7.0 Creates a stable database view for the PDT to enable querying the table outside of Looker
sortkeys Sets the sort keys of a persistent derived table that is built in Redshift
sql (for derived_table) Declares the SQL query for a derived table.
sql_create ADDED5.16 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 persistent derived table to be regenerated
Refinement Parameters
view: +view_name ADDED7.6 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 ADDED7.6 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 REMOVED3.26 Replaced by distribution
view_label AVOID4.4 Replaced by label