<br />

A view represents a table of data in Looker, whether that table is built-in to your database or was created using Looker's [derived table](https://docs.cloud.google.com/looker/docs/derived-tables.md.txt) functionality. Views are typically declared in [view files](https://docs.cloud.google.com/looker/docs/model-and-view-files#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](https://docs.cloud.google.com/looker/docs/reference/param-field.md.txt), [dimension type reference](https://docs.cloud.google.com/looker/docs/reference/param-dimension-filter-parameter-types.md.txt), and [measure type reference](https://docs.cloud.google.com/looker/docs/reference/param-measure-types.md.txt).

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

## Example usage

Hold your pointer 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, ...]

  # CUSTOM CALENDAR PARAMETERS

    calendar_definition: {
      Custom calendar mapping parameters ;;
    }

  # DISPLAY PARAMETERS

  label: "desired label"
  fields_hidden_by_default: yes | no

  # FILTER PARAMETERS

  suggestions: yes | no

  # QUERY PARAMETERS

  autogenerate_primary_keys: yes | no
  required_access_grants: [access_grant_name, access_grant_name, ...]
  sql_table_name: table_name ;;
  derived_analytic_model: {
    sql: analytic_model_definition ;;
  }
  sql_analytic_model_name: analytic_model_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)](https://docs.cloud.google.com/looker/docs/reference/param-view-drill-fields.md.txt) | Specifies the default list of fields shown when drilling into measures defined in the view |
| [`extends` (for view)](https://docs.cloud.google.com/looker/docs/reference/param-view-extends.md.txt) | Specifies view(s) that will be extended by this view |
| [`extension` (for view)](https://docs.cloud.google.com/looker/docs/reference/param-view-extension.md.txt) | Specifies that the view requires extension and cannot itself be exposed to users |
| [`include`](https://docs.cloud.google.com/looker/docs/reference/param-model-include.md.txt) | Adds files to a view |
| [`test`](https://docs.cloud.google.com/looker/docs/reference/param-model-test.md.txt) | Creates a data test to verify your model's logic. The project settings include an option to [require data tests](https://docs.cloud.google.com/looker/docs/git-options.md.txt#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`](https://docs.cloud.google.com/looker/docs/reference/param-view-set.md.txt) | Defines a set of dimensions and measures to be used in other parameters |
| [`view`](https://docs.cloud.google.com/looker/docs/reference/param-view-view.md.txt) | Creates a view |
| Display Parameters ||
| [`label` (for view)](https://docs.cloud.google.com/looker/docs/reference/param-view-label.md.txt) | Specifies how the view name will appear in the field picker |
| [`fields_hidden_by_default`](https://docs.cloud.google.com/looker/docs/reference/param-view-fields-hidden-by-default.md.txt) | Added 21.12 When set to `yes`, hides all fields in the view by default. Use the [`hidden: no`](https://docs.cloud.google.com/looker/docs/reference/param-field-hidden.md.txt) parameter on a field to display the field. |
| Filter Parameters ||
| [`suggestions` (for view)](https://docs.cloud.google.com/looker/docs/reference/param-view-suggestions.md.txt) | Enables or disables suggestions for all dimensions on this view |
| Query Parameters ||
| [`autogenerate_primary_keys` (for view)](https://docs.cloud.google.com/looker/docs/reference/param-explore-autogenerate-primary-keys.md.txt) | Enables or disables automatic primary key generation |
| [`required_access_grants` (for view)](https://docs.cloud.google.com/looker/docs/reference/param-view-required-access-grants.md.txt) | Limits access to the view to only users whose user attribute values match the access grants |
| [`sql_table_name` (for view)](https://docs.cloud.google.com/looker/docs/reference/param-view-sql-table-name.md.txt) | Changes the SQL table on which a view is based |
| Derived Table Parameters ||
| [`cluster_keys`](https://docs.cloud.google.com/looker/docs/reference/param-view-cluster-keys.md.txt) | Specifies that a PDT be clustered by one or more fields in BigQuery <br /> Support added for `cluster_keys` on Snowflake |
| [`create_process`](https://docs.cloud.google.com/looker/docs/reference/param-view-create-process.md.txt) | 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`](https://docs.cloud.google.com/looker/docs/reference/param-view-datagroup-trigger.md.txt) | Specifies the datagroup to use for the PDT rebuilding policy |
| [`derived_table`](https://docs.cloud.google.com/looker/docs/reference/param-view-derived-table.md.txt) | Bases a view on a derived table |
| [`distribution`](https://docs.cloud.google.com/looker/docs/reference/param-view-distribution.md.txt) | Sets the distribution key of a PDT that is built in Redshift or Aster |
| [`distribution_style`](https://docs.cloud.google.com/looker/docs/reference/param-view-distribution-style.md.txt) | Sets the distribution style of a PDT that is built in Redshift |
| [`explore_source`](https://docs.cloud.google.com/looker/docs/reference/param-view-explore-source.md.txt) | Defines a [native derived table](https://docs.cloud.google.com/looker/docs/creating-ndts.md.txt) that's based on an Explore |
| [`increment_key`](https://docs.cloud.google.com/looker/docs/reference/param-view-increment-key.md.txt) | Added 21.4 Makes the derived table into an [incremental PDT](https://docs.cloud.google.com/looker/docs/incremental-pdts.md.txt). The `increment_key` specifies the time increment for which fresh data should be queried and appended to the PDT. |
| [`increment_offset`](https://docs.cloud.google.com/looker/docs/reference/param-view-increment-offset.md.txt) | Added 21.4 Used in conjunction with the `increment_key` parameter for [incremental PDTs.](https://docs.cloud.google.com/looker/docs/incremental-pdts.md.txt) 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`](https://docs.cloud.google.com/looker/docs/reference/param-view-interval-trigger.md.txt) | Added 21.20 The `interval_trigger` specifies a rebuild schedule for a persistent derived table, in the format `"N (seconds | minutes | hours)"` |
| [`materialized_view`](https://docs.cloud.google.com/looker/docs/reference/param-view-materialized-view.md.txt) | Added 21.10 The statement `materialized_view: yes` creates a materialized view on your database for a derived table. |
| [`indexes`](https://docs.cloud.google.com/looker/docs/reference/param-view-indexes.md.txt) | Sets the indexes of a PDT built in a traditional database (for example, MySQL, Postgres) or an interleaved sort key in Redshift |
| [`partition_keys`](https://docs.cloud.google.com/looker/docs/reference/param-view-partition-keys.md.txt) | 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)](https://docs.cloud.google.com/looker/docs/reference/param-view-persist-for-for-derived-table.md.txt) | Sets the maximum age of a PDT before it is regenerated |
| [`publish_as_db_view`](https://docs.cloud.google.com/looker/docs/reference/param-view-publish-as-db-view.md.txt) | The statement `publish_as_db_view: yes` creates a stable database view for the PDT to enable querying the table outside of Looker |
| [`sortkeys`](https://docs.cloud.google.com/looker/docs/reference/param-view-sortkeys.md.txt) | Sets the sort keys of a PDT that is built in Redshift |
| [`sql` (for derived_table)](https://docs.cloud.google.com/looker/docs/reference/param-view-sql-for-derived-table.md.txt) | Declares the SQL query for a derived table |
| [`sql_create`](https://docs.cloud.google.com/looker/docs/reference/param-view-sql-create.md.txt) | Defines a `SQL CREATE` statement to create a PDT on a database dialect that requires custom DDL commands |
| [`sql_trigger_value`](https://docs.cloud.google.com/looker/docs/reference/param-view-sql-trigger-value.md.txt) | Specifies the condition that causes a PDT to be regenerated |
| [`table_compression`](https://docs.cloud.google.com/looker/docs/reference/param-view-table-compression.md.txt) | Specifies the table compression to use for a PDT in Amazon Athena |
| [`table_format`](https://docs.cloud.google.com/looker/docs/reference/param-view-table-format.md.txt) | Specifies the table format to use for a PDT in Amazon Athena |
| Refinement Parameters ||
| [`view: +view_name`](https://docs.cloud.google.com/looker/docs/lookml-refinements.md.txt) | Adds a plus sign (`+`) in front of an existing view name to add a refinement to the existing view. See the [LookML refinements](https://docs.cloud.google.com/looker/docs/lookml-refinements.md.txt) documentation page for more information and use cases. |
| [`final`](https://docs.cloud.google.com/looker/docs/lookml-refinements.md.txt#final) | Indicates that the current refinement is the final refinement allowed for the view. See the [LookML refinements](https://docs.cloud.google.com/looker/docs/lookml-refinements.md.txt#final) documentation page for more information and use cases. |
| Parameters to Avoid ||
| [`distkey`](https://docs.cloud.google.com/looker/docs/reference/param-view-distkey.md.txt) | Removed 3.26 Replaced by [`distribution`](https://docs.cloud.google.com/looker/docs/reference/param-view-distribution.md.txt) |
| [`view_label`](https://docs.cloud.google.com/looker/docs/reference/param-view-view-label.md.txt) | Avoid 4.4 Replaced by [`label`](https://docs.cloud.google.com/looker/docs/reference/param-view-label.md.txt) |