이 가이드에서는 Looker의 모델링 언어인 LookML을 집중적으로 소개하며, 이미 SQL에 능숙한 사용자를 대상으로 합니다.
LookML을 사용하면 구조화되고 재사용 가능한 방식으로 SQL 로직을 정의할 수 있습니다. Looker는 LookML에 정의된 SQL 프래그먼트에서 관련 SQL 문을 조합합니다. LookML 모델을 설정하고 Looker를 데이터베이스에 연결하면 Looker는 데이터베이스에서 데이터를 검색하는 데 필요한 SQL 쿼리를 자동으로 생성합니다.
LookML을 사용하여 SQL을 정의하므로 여러 위치에서 SQL 로직을 반복할 필요가 없습니다. LookML은 코드 재사용성을 높이고 오류를 줄이는 프로그래밍의 핵심 개념인 '반복 금지(DRY)' 원칙을 준수하는 데 도움이 됩니다. 예를 들어 여러 쿼리에서 SQL CASE 문을 사용하여 트랜잭션 코드를 디코딩해야 한다고 가정해 보겠습니다. 여러 쿼리에서 CASE 문을 선언하는 대신 LookML에서 한 번 정의하고 데이터 모델 전체에서 재사용할 수 있습니다.
이 가이드에서는 SQL 쿼리를 분해하고 측정기준, 측정, 뷰, Explore와 같은 재사용 가능한 LookML 요소로 재조합합니다.
다음 페이지에서는 SQL 전문가에게 익숙한 개념을 사용하여 LookML 요소를 설명합니다.
뷰에 대한 SQL 개념: 데이터베이스 테이블을 기반으로 하는 LookML 뷰를 정의하고 맞춤설정하며 SQL 필드를 LookML 측정기준 및 측정에 매핑합니다.
조인에 대한 SQL 개념: LookML에서 뷰 간의 조인을 정의하고 맞춤설정하여 SQL 조인 로직을 미러링하고 테이블 간의 관계를 관리하여 데이터 중복을 방지합니다.
파생 테이블에 대한 SQL 개념: SQL 또는 LookML의 내장된 구문을 사용하여 LookML에서 파생 테이블을 정의하고 맞춤설정하여 반복하지 않고도 복잡한 데이터 로직을 정의하고 재사용할 수 있습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2024-12-22(UTC)"],[],[],null,["# LookML for SQL experts\n\nThis guide provides a focused introduction to LookML, Looker's modeling language, and is specifically intended for those who are already proficient in SQL.\n\nLookML lets you define SQL logic in a structured and reusable way. From the SQL fragments defined in your LookML, Looker assembles relevant SQL statements. Once you've set up your LookML model and connected Looker to your database, Looker automatically generates the necessary SQL queries to retrieve data from your database.\n\nBecause you use LookML to define your SQL, you don't need to repeat SQL logic in multiple places. LookML helps you adhere to the \"Don't Repeat Yourself (DRY)\" principle, a key concept in programming that promotes code reusability and reduces errors. For example, imagine that you need to decode transaction codes by using a SQL `CASE` statement across multiple queries. Instead of declaring the `CASE` statement in multiple queries, you can define it once in LookML and reuse it throughout your data model.\n\nIn this guide, you'll deconstruct SQL queries and reassemble them into reusable LookML elements such as dimensions, measures, views, and Explores.\n\nThe following pages explain LookML elements by using concepts familiar to SQL experts:\n\n- [SQL concepts for views](/looker/docs/sql-experts-view): Define and customize LookML views, which are based on database tables, and map your SQL fields to LookML dimensions and measures.\n- [SQL concepts for joins](/looker/docs/sql-experts-joins): Define and customize joins between views in LookML to mirror SQL join logic, and manage relationships between tables to avoid data duplication.\n- [SQL concepts for derived tables](/looker/docs/sql-experts-derived-tables): Define and customize derived tables in LookML by using either SQL or LookML's built-in syntax to define and reuse complex data logic without repeating yourself.\n\nRelated resources\n-----------------\n\n- [Using Looker's SQL Generator (Community article)](https://www.googlecloudcommunity.com/gc/Technical-Tips-Tricks/Using-Looker-s-SQL-Generator/ta-p/814623)\n- [How Looker generates SQL](/looker/docs/how-looker-generates-sql)\n- [Looker cookbook: Maximizing code reusability with DRY LookML](/looker/docs/best-practices/dry-lookml-cookbook)"]]