本页面链接到定义字段的所有 LookML 参数。
字段类型有多种:
- 维度表示表中的列,或基于某种列操作或组合的计算值
- 维度组仅适用于基于时间的数据,可让您一次性创建多个基于时间的维度
- 指标类似于 SQL 中的聚合函数(例如
COUNT、SUM、AVG),表示有关多行的信息 - 过滤条件:创建仅用于过滤的字段,用户可以使用该字段为模板化过滤条件或条件联接提供输入内容
- 参数会创建一个仅限过滤条件的字段,用户可以使用该字段为 Liquid
{% parameter %}标记提供输入内容
用法示例
将指针悬停在参数名称上即可查看简短说明。点击参数名称可跳转到其参考页面。
如果某个形参可以设置为多个特定选项中的一个,则默认值会列在最前面。
## STRUCTURAL PARAMETERS view: view_name { (dimension |dimension_group |measure |filter | parameter):field_name{ intervals: [interval, interval, …] timeframes: [timeframe, timeframe, …] # ACTION AND LINKING PARAMETERS action: { label: "Label to Appear in Action Menu" url: "url" icon_url: "url" form_url: "url" param: { name: "name string" value: "value string" } # Possibly more param definitions form_param: { name: "title" type: select | string | textarea label: "desired label name" required: yes | no default: "value string" option: { name: "name string" value: "value string" } # Possibly more option definitions } # Possibly more form_param definitions } drill_fields: [field_or_set, field_or_set, ...] tags: ["string1", "string2", ...] link: { label: "desired label name;" url: "desired_url" icon_url: "url_of_an_image_file" } # Possibly more link definitions # DISPLAY PARAMETERS alias: [old_field_name, old_field_name, ...] alpha_sort: yes | no description: "description string" group_label: "desired group label name" group_item_label: "label to use under the group label in the field picker" hidden: yes | no label: "desired label name" label_from_parameter: parameter_name order_by_field: dimension_name | dimension_group_name | measure_name style: classic | interval | integer | relational view_label: "desired label name" # FILTER PARAMETERS can_filter: yes | no case_sensitive: yes | no filters: [dimension: "filter expression", dimension: "filter expression", ...] skip_drill_filter: yes | no # FILTER SUGGESTION PARAMETERS allowed_value: { label: "desired label name" value: "looker filter expression" } # Possibly more allowed_value definitions bypass_suggest_restrictions: yes | no full_suggestions: yes | no suggest_dimension: dimension_name suggest_explore: explore_name suggest_persist_for: "N (seconds | minutes | hours)" suggestable: yes | no suggestions: ["suggestion string", "suggestion string", "…"]< # QUERY PARAMETERS allow_approximate_optimization: yes | no approximate: yes | no approximate_threshold: N convert_tz: yes | no datatype: epoch | timestamp | datetime | date | yyyymmdd fanout_on: repeated_record_name precision: N primary_key: yes | no required_access_grants: [access_grant_name, access_grant_name, ...] required_fields: [field_name, field_name, ...] sql_distinct_key: SQL expression to define repeated entities ;; # VALUE AND FORMATTING PARAMETERS case: { when: { sql: SQL condition ;; label: "value" } # Possibly more when statements } default_value: "desired default value" direction: "row | column" end_location_field: dimension_name html: HTML expression using Liquid template elements ;; list_field: dimension_name percentile: Nth percentile sql: SQL expression to generate the field value ;; sql_end: SQL expression indicating the end time of a duration ;; sql_latitude: SQL expression to generate a latitude ;; sql_longitude: SQL expression to generate a longitude ;; sql_start: SQL expression indicating the start time of a duration ;; start_location_field: dimension_name synonyms: [synonym1, synonym2, ...] tiers: [N, N, ...] type: dimension_field_type # For a dimension field type: dimension_group_type # For a dimension_group field type: measure_field_type # For a measure field type: filter_field_type # For a filter field type: parameter_field_type # For a parameter field string_datatype: unicode # For a dimension field units: feet | kilometers | meters | miles | nautical_miles | yards value_format: "excel-style formatting string" value_format_name: format_name # VISUALIZATION PARAMETERS allow_fill: yes | no map_layer_name: name_of_map_layer } }
参数定义
- D = Dimension
- DG = Dimension Group
- M = Measure
- F = 过滤条件
- P = Parameter
| 参数名称 | 有效的字段类型 | 说明 |
|---|---|---|
| 结构参数 | ||
dimension
|
D | 创建维度字段 |
dimension_group
|
DG | 同时创建多个基于时间的维度 |
filter
|
F | 创建仅用于过滤的字段,以便在模板化过滤条件或条件联接中使用 |
measure
|
M | 创建度量字段 |
parameter
|
P | 创建仅限过滤的字段,供用户用于向 Liquid {% parameter %} 标记提供输入内容 |
intervals
|
DG | 定义您希望在 type: duration 的 dimension_group 中包含的一组时长维度 |
timeframes
|
DG | 定义您希望在 type: time 的 dimension_group 中包含的时间范围维度集 |
| 操作和关联参数 | ||
action
|
D M | 在字段上创建数据操作,让用户可以直接在 Looker 中借助其他工具完成任务 |
drill_fields
|
D DG M | 声明在深入分析指标或维度时将显示的字段列表 |
link
|
D M | 创建指向其他 Looker 内容和外部内容的链接 |
tags
|
D DG M F P | 添加可传递给其他应用的文本,以提供有关字段的数据 |
| 展示参数 | ||
alias
|
D DG M F P | 允许在重命名字段后,包含旧字段名称的已保存网址仍能正常运行 |
alpha_sort
|
D | 使 case 参数按字母顺序对条件进行排序
|
description
|
D DG M F P | 向字段添加说明,用户将鼠标悬停在字段上时即可看到该说明。 |
group_label
|
D DG M F | 在字段选择器中将字段分组到视图中 |
group_item_label
|
D DG M F | 指定要在字段选择器中用于其组标签下方的字段的标签 |
hidden
|
D DG M F P | 在探索界面中隐藏字段 |
label
|
D DG M F P | 更改字段名称在字段选择器中的显示方式 |
label_from_parameter
|
D M | 根据 parameter 的输入更改可视化图表中字段名称的显示方式 |
order_by_field
|
D DG M | 按另一个字段的值对某个字段进行排序 支持维度、维度组 支持的衡量指标 |
style
|
D | 更改 Looker 界面中维度 type: tier 的分层显示方式 |
view_label
|
D DG M F P | 更改字段选择器中视图内显示的字段 |
| 过滤参数 | ||
can_filter
|
D DG M | 确定维度或度量是否可用作过滤条件 |
case_sensitive
|
D F | 确定过滤条件是否区分维度的大小写 |
filter
|
F | 创建仅限过滤条件的字段,以用于模板化过滤条件 |
filters
|
M | 根据维度限制来限制指标的计算 |
skip_drill_filter
|
D | 在深入分析指标时,阻止将维度添加到过滤条件中 |
| 过滤条件建议参数 | ||
allowed_value
|
P | 指定 parameter 的选项 |
bypass_suggest_restrictions
|
D DG F P | 在 sql_always_where 处于使用状态时向用户显示建议,但不将这些限制应用于建议 |
full_suggestions
|
D DG F P | 控制 Looker 如何查询数据库,以便在探索的过滤条件中为字段的值提供建议。Looker 可以使用基本的 SELECT DISTINCT 查询,也可以使用探索的完整逻辑,包括联接以及 sql_always_where 和 access_filter 参数。 |
suggest_dimension
|
D DG M F P | 根据不同维度的值为字段提供建议 |
suggest_explore
|
D DG M F P | 根据其他探索的值为某个字段提供建议 |
suggest_persist_for
|
D F P | 更改 Looker 过滤条件建议的缓存设置 |
suggestable
|
D DG M F P | 为字段启用或停用建议 |
suggestions
|
D F P | 声明将用于字段建议的值列表 |
| 查询参数 | ||
allow_approximate_optimization |
M | 允许对 type: count 或 type: count_distinct 的衡量指标进行近似去重计数,以便该衡量指标可用于汇总认知度 |
approximate |
M | 对 type: count_distinct 的衡量指标执行近似计数。如需查看支持此参数的方言列表,请参阅 approximate 文档页面。 |
approximate_threshold
|
M | 设置 BigQuery 从精确去重计数切换到近似去重计数的数量 |
convert_tz
|
D DG M F P | 针对某个字段停用自动时区转换 |
datatype
|
D DG F M | 指定您为字段提供的时间数据类型 |
fanout_on
|
D DG M | 启用对 Google BigQuery 重复字段的访问权限 |
precision
|
M | 指定在计算 Looker 对称汇总时使用的小数位数 |
primary_key
|
D | 将某个维度声明为视图的主键 |
required_access_grants |
D DG F M P | 将对相应字段的访问权限限制为仅限用户属性值与访问权限授予相匹配的用户 |
required_fields
|
D M | 要求在选择某个字段时,向查询添加其他字段 |
sql_distinct_key
|
M | 定义将计算 type: sum_distinct 或 type: average_distinct 的唯一实体 |
| 值和格式设置参数 | ||
case
|
D | 根据 SQL 条件创建维度可具有的一组离散值 |
default_value
|
F P | 为过滤条件字段指定默认值 |
direction
|
M | 确定使用透视时计算 type: percent_of_total 或 type: running_total 度量的方向 |
end_location_field
|
D | 定义包含 type: distance 类型字段的结束位置的字段 |
html
|
D DG M | 使用 Liquid 模板修改字段的 HTML 输出 |
list_field
|
M | 声明将用于计算 type: list 的维度 |
percentile
|
M | 指定 type: percentile 或 type: percentile_distinct 指标的分数值(第 N 个百分位) |
sql
|
D DG M F | 确定字段的计算方式 |
sql_end
|
D DG | 定义时长型维度组或时长型维度的时长结束时间 |
sql_latitude
|
D | 定义维度 type: location 的纬度 |
sql_longitude
|
D | 定义维度为 type: location 的经度 |
sql_start
|
D DG | 定义时长型维度组或时长型维度的时长开始时间 |
start_location_field
|
D | 定义包含 type: distance 类型字段的起始位置的字段 |
synonyms
|
D DG F M P | 指定一个字符串同义词(字词或短语)列表,用于帮助大型语言模型和应用开发者了解用户可能会以哪些其他方式提及某个字段 |
tiers
|
D | 为 type: tier 维度定义层级 |
type(对于维度、过滤条件或参数)
|
D F P | 指定维度、过滤条件或参数的类型 |
type(适用于维度组)
|
DG | 指定维度组的类型 |
type(针对衡量)
|
M | 指定衡量指标的类型 |
string_datatype
|
D | 为 SQL Server 或 MySQL 的 type: string 字段指定 Unicode 数据类型 |
units
|
D | 指定 type: distance 字段所使用的单位 |
value_format
|
D M | 使用 Excel 样式选项设置字段输出的格式 |
value_format_name
|
D M | 使用内置或自定义格式设置字段的输出格式 |
| 可视化参数 | ||
allow_fill
|
D DG | 确定是否允许为维度填充维度 |
map_layer_name
|
D | 指定从数据值到您在内置地图或自定义地图上定义的地理区域的映射 |
| 应避免的参数 | ||
decimals
|
D M |
移除了 5.4
已替换为 value_format
|
format
|
D M |
已移除 3.16
已替换为 value_format |