모델 파일은 데이터베이스 연결을 지정하고, 해당 연결을 사용하는 Explore 집합을 정의하고, Explore와 다른 뷰 간의 관계를 정의합니다. 다른 LookML 요소와 달리 모델은 특정 'model' 매개변수로 선언되지 않습니다. 대신 LookML 개발자는 .model.lkml 파일 확장자가 있는 LookML 프로젝트 파일을 만들어 모델을 정의합니다. 모델 이름은 파일 이름에서 가져옵니다.
모델 이름은 인스턴스의 모든 프로젝트에서 고유해야 합니다. 인스턴스에 이름이 동일한 .model.lkml 파일이 두 개 포함되어 있으면 LookML 대시보드가 URL 형식 (<hostname>/dashboard/model_name::<dashboard_name>
LookML 검사기를 사용하여 인스턴스에서 모델 이름이 중복되는지 확인할 수 있습니다. 하지만 LookML 검사기에서 인스턴스의 중복 모델 이름을 감지하더라도 코드를 프로덕션에 푸시할 수 있습니다. 따라서 LookML 프로젝트를 프로덕션에 배포하기 전에 중복 모델 이름 오류를 수정해야 합니다.
모델 파일에는 일반적으로 여러 모델 수준 설정과 함께 explore 선언이 포함됩니다.
이 페이지는 모델 수준 LookML 매개변수로 연결됩니다. 일반적으로 모델 파일 상단에 작성되며 다른 파라미터 내에 중첩되지 않아야 합니다.
사용 예시
매개변수 이름 위로 마우스 포인터를 가져가면 간단한 설명이 표시됩니다. 매개변수를 클릭하여 참조 페이지로 이동합니다. 매개변수를 여러 특정 옵션 중 하나로 설정할 수 있는 경우 기본값이 먼저 나열됩니다.
## 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
매개변수 정의
| 파라미터 이름 | 설명 |
|---|---|
| 구조적 매개변수 | |
access_grant |
승인된 사용자 속성 값이 할당된 사용자에게만 LookML 구조에 대한 액세스를 제한하는 액세스 권한 부여를 만듭니다. 이 매개변수에는 user_attribute 및 allowed_values 하위 매개변수가 있습니다. |
explore |
Explore 메뉴에 뷰를 노출합니다. Explore 및 해당 매개변수에 대한 자세한 내용은 Explore 매개변수 참조 페이지를 참고하세요. |
include |
모델에 파일을 추가합니다. |
test |
모델의 논리를 확인하기 위한 데이터 테스트를 만듭니다. 프로젝트 설정에는 데이터 테스트를 요구하는 옵션이 포함되어 있습니다. 프로젝트에 이 옵션이 사용 설정되면 프로젝트의 개발자는 변경사항을 프로덕션에 배포하기 전에 데이터 테스트를 실행해야 합니다. 이 매개변수에는 explore_source 및 assert 하위 매개변수가 있습니다. |
| 디스플레이 매개변수 | |
label (모델용) |
Explore 메뉴에 모델이 표시되는 방식을 변경합니다. |
| 필터 매개변수 | |
case_sensitive (모델용) |
모델의 필터가 대소문자를 구분하는지 여부를 지정합니다. |
| 쿼리 매개변수 | |
connection |
모델의 데이터베이스 연결을 변경합니다. |
datagroup |
모델의 데이터 그룹 캐싱 정책을 만듭니다. 이 매개변수에는 label, description, max_cache_age, sql_trigger 하위 매개변수가 있습니다. |
fiscal_month_offset |
회계 연도가 달력 연도와 다른 경우 회계 연도가 시작되는 월을 지정합니다. |
persist_for (모델용) |
모델의 캐시 설정을 변경합니다. |
persist_with (모델용) |
모델의 캐싱 정책에 사용할 데이터 그룹을 지정합니다. |
week_start_day |
주 관련 측정기준이 시작되는 요일을 지정합니다. |
| 시각화 및 형식 지정 매개변수 | |
map_layer (모델용) |
map_layer_name와 함께 사용할 맞춤 지도를 만듭니다. |
named_value_format |
value_format_name와 함께 사용할 맞춤 값 형식을 만듭니다. 이 매개변수에는 value_format 및 strict_value_format 하위 매개변수가 있습니다. |
| 피해야 할 매개변수 | |
scoping |
3.52 삭제 더 이상 필요하지 않음 |
template |
3.30 삭제 더 이상 필요하지 않음 |