이 예시에서는 transactions Explore 정의 내에서 extends 매개변수를 사용하여 orders 탐색을 확장합니다.
이 페이지에서는 기본 객체로 확장되는 객체를 참조하며, 확장을 수행하는 객체를 확장 객체라고 합니다.
LookML 객체를 확장하는 것은 매우 간단한 프로세스입니다. 자세한 내용은 확장을 통해 코드 재사용 문서 페이지를 참조하세요. 그러나 LookML 참조 오류와 원치 않는 객체 중복을 유발할 수 있는 몇 가지 고급 사용 사례가 있습니다. 이 페이지에서는 다른 뷰를 확장하는 뷰를 기반으로 Explore를 확장하면 LookML 참조 오류가 발생할 수 있는 방법과 이러한 문제를 해결하는 데 도움이 되는 팁을 제공합니다.
사용 사례: 확장 뷰에 따라 Explore 확장
events Explore를 확장하려고 하고 확장 Explore의 기반이 되는 뷰가 기본 events 뷰를 확장하는 뷰의 필드를 사용하려고 한다고 가정해 보겠습니다. 이 예시에서 events_extended Explore는 다음 LookML 예시와 같이 extends Explore를 확장합니다.
이 예시에서는 users 뷰가 기본 events Explore에 조인되고 orders 뷰는 Explore 탐색 events_extended에 조인됩니다. 하지만 기본 events Explore에 정의된 조인은 기본 events 뷰의 필드인 events.user_id를 참조합니다. 한편 확장 events_extended Explore에 정의된 조인은 events_extended.test_id 필드를 참조합니다. 여기서 events_extended는 events 뷰를 기반으로 하는 확장 뷰의 이름입니다. events_extended Explore에 정의된 조인에서 참조되는 test_id 필드는 다음과 같이 확장 events_extended 뷰에 정의됩니다.
events_extended Explore에 정의된 조인이 확장 뷰의 이름 events_extended를 참조하기 때문에 LookML 검사기에 inaccessible view 오류가 표시됩니다.
이 문제를 해결하려면 확장 Explore의 LookML에 from 매개변수를 추가하고 해당 값을 확장 뷰의 이름 events_extended로 설정하면 됩니다. from 매개변수는 생성된 SQL에서 원래 테이블 이름의 별칭을 FROM schema.name AS alias로 지정합니다.
Explore 수준에서 from 매개변수를 적용할 때 유일하게 권장되는 사용 사례입니다.
기본 Explore(events)에서 조인 참조를 중단하지 않고 확장 뷰(events_extended)에서 가져오려면 확장 뷰에 매핑되는 from 매개변수를 추가하면 됩니다.
이 예시에서 확장 Explore의 LookML에 LookML from: events_extended를 적용하면 확장 Explore에서 기본 뷰(events)를 계속 참조하면서 해당 뷰의 확장 버전(events_extended)에서 가져올 수 있도록 해당 참조를 리디렉션할 수 있습니다.
from 매개변수를 사용하면 조인 프리픽스에서 기본 뷰 이름 events를 계속 참조할 수 있지만, 이러한 참조는 events의 모든 필드와 새로운 test_id 필드가 포함된 확장 뷰 events_extended에서 가져옵니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-30(UTC)"],[],[],null,["# Troubleshooting an example of an advanced extends use case\n\n\u003e *This page covers an advanced topic and assumes a solid knowledge of LookML on the part of the reader.*\n\n\n[Extends](/looker/docs/reusing-code-with-extends) is a valuable LookML feature that allows you to maintain DRY (don't repeat yourself) LookML code. In Looker, [Explores](/looker/docs/reference/param-explore-extends), [views](/looker/docs/reference/param-view-extends), and [LookML dashboards](/looker/docs/reusing-code-with-extends#extending_a_lookml_dashboard) can all be extended with the `extends` parameter within a model file, such as in the following example: \n\n```\nexplore: orders {\n view_name: orders\n join: users {\n type: left_outer\n sql_on: %{orders.user_id} = ${users.id} ;;\n relationship: many_to_one\n }\n}\n\nexplore: transactions {\n extends: [orders]\n}\n```\n\n\nIn this example, the `extends` parameter is used within the definition of the `transactions` Explore to extend the `orders` Explore.\n\n\nThis page refers to the object that is being extended as the *base* object, and the object that is doing the extending is referred to as the *extending* object.\n\n\nExtending a LookML object is a fairly straightforward process, as detailed on the [Reusing code with extends](/looker/docs/reusing-code-with-extends#details_of_extend_functionality) documentation page. However, there are some advanced use cases that can cause LookML reference errors and unwanted object duplication. This page provides an example of how extending an Explore based on a view that extends another view can result in LookML reference errors, as well as tips that can help eliminate such issues.\n\nUse case: Extending an Explore based on an extending view\n---------------------------------------------------------\n\n\nSuppose you want to extend the `events` Explore, and you want the view that the extending Explore is based on to use fields from a view that extends the base `events` view. In this example, the `events_extended` Explore extends the `extends` Explore, as shown in the following example LookML: \n\n```\nexplore: events {\n view_name: events\n join: users {\n type: left_outer\n sql_on: ${events.user_id} = ${users.id} ;;\n relationship: many_to_one\n }\n}\n\nexplore: events_extended {\n extends: [events]\n join: orders {\n sql_on: ${events_extended.test_id} = ${orders.id} ;;\n relationship: many_to_one\n }\n```\n\n\nIn this example, the `users` view is joined to the base `events` Explore, while the `orders` view is joined to the extending Explore, `events_extended`. However, the join defined in the base `events` Explore references `events.user_id`, which is a field from the base `events` view. Meanwhile, the join defined in the extending `events_extended` Explore references the field `events_extended.test_id`, where `events_extended` is the name of an extending view based on the `events` view. The `test_id` field that is referenced in the join in the `events_extended` Explore definition is defined in the extending `events_extended` view as follows: \n\n```\ninclude: \"events.view.lkml\"\nview: events_extended {\n extends: [events]\n\n dimension: test_id {}\n```\n\n\nBecause the join defined in the `events_extended` Explore references the name of the extending view, `events_extended`, the [LookML Validator](/looker/docs/lookml-validation#validating_your_lookml) displays an [`inaccessible view`](/looker/docs/error-catalog#inaccessible_view_(?)._(?)_is_not_accessible_in_explore_(?)._check_for_missing_joins_in_explore_(?).) error.\n\n\nTo address this, you can add the [`from`](/looker/docs/reference/param-explore-from) parameter to the LookML for the extending Explore and set its value to the name of the extending view, `events_extended`. The `from` parameter aliases the original table name in the generated SQL, as `FROM schema.name AS alias`.\n\u003e *This is the only recommended use case for applying the `from` parameter at the Explore level.*\n\n\nTo pull from the extending view (`events_extended`) without breaking the join references from the base Explore (`events`), you can add a `from` parameter that maps to the extending view: \n\n```\nexplore: events_extended {\n extends: [events]\n from: events_extended\n join: orders {\n relationship: many_to_one\n sql_on: ${events.test_id} = ${orders.id} ;;\n }\n}\n```\n\n\nIn this example, applying the LookML `from: events_extended` to the LookML for the extending Explore lets you continue referencing the base view (`events`) in the extending Explore, while redirecting those references to pull from the extending version of that view (`events_extended`).\n\n\nWith the use of the `from` parameter, you can continue to reference the base view name `events` in the join prefixes, but these references will pull from the extending view `events_extended`, which contains all the fields in `events`, plus the new `test_id` field.\n\n\u003cbr /\u003e"]]