A model file
specifies a database connection, defines the set of Explores
that use that connection, and defines the Explores' relationships to other views. Unlike other LookML elements, a model is not declared with a specific "model" parameter. Instead, a LookML developer defines a model by creating a LookML project file that has the .model.lkml
file extension. The model name is taken from the filename.
A model name must be unique across all projects on your instance. If your instance contains two .model.lkml
files with the same name, it is likely that you will encounter errors, such as model configuration errors on the LookML Projectspage
and rendering errors for LookML dashboard errors, since LookML dashboards use the model name in their URL format ( <hostname>/dashboard/model_name::<dashboard_name>
You can use the LookML Validator to verify if model names are duplicated across your instance. However, even if the LookML Validator detects duplicate model names on your instance, you can still push your code to production. Therefore, be sure to fix any duplicate model name errors before you deploy your LookML project to production.
A model file typically contains any explore
declarations, along with a number of model-level settings.
This page links to the model-level LookML parameters. They are typically written at the top of the model file and shouldn't be nested within other parameters.
Example usage
Hold the 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 explore
:
explore_name
{
# Desired explore parameters (described on Explore Parameters
page) }
## Possibly more explore declarations access_grant
:
access_grant_name
{
user_attribute
:
user_attribute_name
allowed_values
: [
"value_1"
,
"value_2"
, ...]
}
## Possibly more access_grant 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
## DISPLAY PARAMETERS label
:
"desired label"
## FILTER PARAMETERS case_sensitive
:
yes
| no
## QUERY PARAMETERS connection
:
"connection_name"
datagroup
:
datagroup_name
{
label
:
"desired label"
description
:
"desired description"
max_cache_age
:
"N (minutes | hours | days)"
sql_trigger
:
SQL query ;;
}
## Possibly more datagroup declarations fiscal_month_offset
:
N
persist_for
:
"N (seconds | minutes | hours)"
persist_with
:
datagroup_name
week_start_day
:
monday
| tuesday
| wednesday
| thursday
| friday
| saturday
| sunday
## VISUALIZATION AND FORMATTING PARAMETERS map_layer
:
map_name
{
extents_json_url
:
"URL to JSON extents file"
feature_key
:
"Name of TopoJSON object"
file
:
"TopoJSON or GeoJSON filename"
# or use the url subparameter
format
:
topojson
| vector_tile_region
label
:
"desired label"
max_zoom_level
:
number indicating max zoom
min_zoom_level
:
number indicating min zoom
projection
:
Preferred geographic projection
property_key
:
"TopoJSON property"
property_label_key
:
"Label for TopoJSON property"
url
:
"URL that contains map file"
# or use the file subparameter }
## Possibly more map layer declarations named_value_format
:
desired_name
{
value_format
:
"excel formatting string"
strict_value_format
:
yes
| no
}
## Possibly more named value format declarations
Parameter definitions
user_attribute
and allowed_values
subparameters.explore_source
and assert
subparameters.label
, description
, max_cache_age
, and sql_trigger
subparameters.map_layer_name
value_format_name
. This parameter has the value_format
and strict_value_format
subparameters.
