Przejdź do treści
Biblioteka skilli
Dane i analityka · Nauka i wyjaśnianie

lookml-fields

/lookml-fields

Opisuje typy pól LookML (dimension, measure, filter, parameter) i rolę parametru sql w każdym z nich, aby dobrać właściwy typ pola do modelowania danych.

Repozytorium
looker-skills ↗
Licencja
Apache-2.0
Ostatnia zmiana repozytorium
15.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
6
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 15.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

Co robi i kiedy

Opisuje typy pól LookML (dimension, measure, filter, parameter) i rolę parametru sql w każdym z nich, aby dobrać właściwy typ pola do modelowania danych.

Oryginalny opis (EN)

Overview of LookML field types (Dimension, Measure, Filter, Parameter) and the role of the `sql` parameter in each. Use this skill to choose the right field type for your data modeling needs.

Jak działa

  1. 1. Field Types Overview
  2. 2. The Role of sql Parameter
  3. 3. Summary of Differences
  4. Reference Skills
Sekcje z nagłówków SKILL.md, w oryginale · 110 linii, 691 słów
Podgląd SKILL.md
---
name: lookml-fields
description: Overview of LookML field types (Dimension, Measure, Filter, Parameter) and the role of the `sql` parameter in each. Use this skill to choose the right field type for your data modeling needs.
license: Apache-2.0
metadata:
  publisher: google
  version: v1
---

# Instructions

## 1. Field Types Overview

LookML fields are the building blocks of your data model. Each type serves a specific purpose in generating SQL.

| Field Type | Purpose | SQL Generation Phase |
| :--- | :--- | :--- |
| **Dimension** | Describes data (attributes). Groups results. | `SELECT` and `GROUP BY` clause. |
| **Measure** | Aggregates data (metrics). Calculates results. | `SELECT` clause (with aggregation). |
| **Filter** | Restricts data based on conditions. | `WHERE` or `HAVING` clause (via templated filters). |
| **Parameter** | Captures user input for dynamic logic. | *None directly* (injects values into other fields). |
| **Dimension Group** | Generates time-based dimensions (`type: time`) or calculates date diffs/durations (`type: duration`). | `SELECT` and `GROUP BY` clause (multiple columns). |

## 2. The Role of `sql` Parameter

The `sql` parameter behaves differently strictly based on the field type.

### Dimensions: The "What"
*   **Role**: Defines the raw transformation of the column *before* any aggregation.
*   **SQL Context**: The expression is placed directly into the `GROUP BY` clause.
*   **Input**: Can reference table columns (`${TABLE}.col`), other dimensions (`${dim}`), or raw SQL functions.
*   **Example**:
    ```lookml
    dimension: full_name {
      sql: CONCAT(${first_name}, ' ', ${last_name}) ;;
    }
    -- Generates: CONCAT(table.first_name, ' ', table.last_name)
    ```

### Measures: The "How Much"
*   **Role**: Defines the value to be aggregated *or* the calculation involving other aggregates.
*   **SQL Context**: Puts the expression *inside* the aggregation function (e.g., `SUM(sql)`), or as a standalone calculation for `type: number`.
*   **Input**:
    *   For `type: sum/avg/min/max`: References dimensions or columns.
    *   For `type: number`: References other *measures*.
    *   For `type: count`: `sql` is **ignored** (always `COUNT(*)` or `COUNT(primary_key)`).
*   **Example**:
    ```lookml
    measure: total_profit {
      type: sum
      sql: ${sale_price} - ${cost} ;; 
    }
    -- Generates: SUM(sale_price - cost)
    ```

### Filters: The "Which"
*   **Role**: Defines the condition logic, *usually* for Templated Filters used in Derived Tables or `sql_always_where`.
*   **SQL Context**: The `sql` parameter in a `filter` field is **rarely used directly** in modern LookML. Instead, the *input* to the filter is used in `{% condition %}` tags.
*   **Best Practice**: Identify if you need a `filter` field or just a `parameter` + `dimension`.
*   **Example (Templated Filter)**:
    ```lookml
    filter: date_filter { type: date }
    -- Usage in Derived Table SQL:
    -- WHERE {% condition date_filter %} created_at {% endcondition %}
    ```

### Parameters: The "User Input"
*   **Role**: Does **NOT** generate SQL itself. It holds a user-selected value to be injected into *other* fields.
*   **SQL Context**: Accessed via Liquid variables (`{% parameter name %}`) inside Dimensions, Measures, or Derived Tables.
*   **Input**: User selects from a UI list or types a value.
*   **Example**:
    ```lookml
    parameter: timeframe_selector {
      type: unquoted
      allowed_value: { value: "month" }
      allowed_value: { value: "year" }
    }
    dimension: dynamic_date {
      sql: DATE_TRUNC({% parameter timeframe_selector %}, ${created_raw}) ;;
    }
    ```

### Dimension Groups: The "Time Generator & Date Diff Calculator"
*   **Role**: For `type: time`, generates multiple timeframes from a source timestamp. For `type: duration`, calculates time elapsed / date differences (e.g. `month_since_signup`, `datediff`) between two timestamps.
*   **SQL Context**: Casts, truncates, or calculates date differences across columns.
*   **Input**: Standardized timestamp/date expressions or start/end timestamp columns.
*   **Example**:
    ```lookml
    dimension_group: created {
      type: time
      timeframes: [date, month]
      sql: ${TABLE}.created_at ;;
    }
    -- Generates:
    -- created_date -> CAST(table.created_at AS DATE)
    -- created_month -> DATE_TRUNC(table.created_at, MONTH)
    ```

## 3. Summary of Differences

| Type | `sql` references... | Can reference Measures? | Aggregated? |
| :--- | :--- | :--- | :--- |
| **Dimension** | Columns, Other Dimensions | **NO** | No |
| **Measure (Agg)** | Columns, Dimensions | **NO** | Yes |
| **Measure (Num)** | **Other Measures** | **YES** | Yes (already agg) |
| **Filter** | (Rarely used) | No | N/A |
| **Parameter** | (None) | No | N/A |

## Reference Skills

For detailed standards on specific field types, refer to:
- [Dimensions](references/dimension.md): Naming, labels, and type-specific rules.
- [Measures](references/measure.md): Aggregation types, filters, and formats.
- [Filters & Parameters](references/filter_parameter.md): Templated filters and user input.
- [Dimension Groups](references/dimension_group.md): Timeframes and intervals.
- [Value Formats](references/value_format.md): Named and custom currency/number formats.

Pliki w paczce (6)
  • SKILL.md 5 KB
  • references/dimension.md 3 KB
  • references/dimension_group.md 6 KB
  • references/filter_parameter.md 2 KB
  • references/measure.md 2 KB
  • references/value_format.md 7 KB

Wersje

W bazie nie ma innych skilli o nazwie lookml-fields.

Migawka bazy z 13.11.2026 · wersja paczki 876ab09ae26a (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100lookml-liquid
    Stosuje zmienne Liquid w LookML do dynamicznego SQL, HTML i linków, w tym wzorce optymalizacji zapytań.
  • 100lookml-view
    Tworzy i zmienia widoki LookML: podstawowe definicje, sql_table_name, organizację plików i wzorce.
  • 100looker-expert
    Wspiera pracę z Looker BI i LookML: eksploracje, wymiary, miary, dashboardy, trwałe tabele pochodne, łączenia i modelowanie danych.
  • 100droughty
    Obsługuje zestaw Droughty do introspekcji schematów: konfiguracja profilu i projektu, generowanie LookML z hurtowni, testy dbt, diagramy DBML, dokumentacja pól i raporty jakości danych.
  • 100bi-measure-builder
    Pisze, wyjaśnia, debuguje i optymalizuje obliczenia BI: miary DAX w Power BI i Fabric, pola obliczeniowe Tableau z wyrażeniami LOD oraz miary LookML w Looker.
  • 100modeler
    Buduje, waliduje i zarządza modelami semantycznymi w Sidemantic: warstwa semantyczna, metryki i wymiary, modele ze schematu bazy lub zapytań SQL oraz import z Cube, dbt i LookML, głównie przez CLI i YAML.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.