mcpField
L
lookml-view

lookml-view

github.com/lkrdevData & databases1661 installsUpdated 22w ago
Repository

About lookml-view

lookml-view is a skill for LookML developers that provides conventions for organizing and writing view files. It covers standard views, extensions, refinements, and derived-table structures, with rules for primary keys and table names.

Key features

  1. 01Defines view file layout and naming
  2. 02Requires explicit table names for standard views
  3. 03Specifies primary-key dimension placement and marking
  4. 04Explains extension and refinement syntax
  5. 05Mentions standard and native derived-table patterns

Use cases

  1. 01Create a standard view that follows conventions
  2. 02Refine a view without changing its source file
  3. 03Reuse existing view logic through extensions
  4. 04Organize LookML files for derived tables

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/lkrdev/lookml_skills --skill lookml-view

After installing, type/lookml-viewin Claude Code to confirm it loaded.

Bundled filesreferences/derived_table.md

Details

From the project README

Instructions

1. File Organization

  • Standard Views: views/[datasource_name]/[view_name].view.lkml
  • Extended Views: views/[datasource_name]/[view_name]_ext.view.lkml
  • Refinements: views/[datasource_name]/[view_name]_rfn.view.lkml
  • NDTs: views/[datasource_name]/[view_name]_ndt.view.lkml
  • SDTs: views/[datasource_name]/[view_name]_sdt.view.lkml

2. Core Standards

  1. sql_table_name: Required for standard views. Defaults are fragile; be explicit.
  2. Primary Key:
    • Must be the first dimension defined in the file.
    • Must have primary_key: yes.
  3. Refinements: Use + before the view name (e.g., view: +users) to refine existing views without modifying the original file.
  4. Extensions: Use extends to reuse logic from other views.

3. Best Practices

  • Naming: Use snake_case for view names and filenames.
  • Descriptions: Add descriptions to the view itself if it helps explain its purpose (e.g., "Daily active users aggregated by region").
  • Output Format: Ensure the file ends with a newline.

4. Related Skills

Examples

Basic View

view: users {
  sql_table_name: `project.dataset.users` ;;

  dimension: user_id {
    primary_key: yes
    type: number
    sql: ${TABLE}.id ;;
    group_label: "IDs"
    description: "Unique internal user ID."
  }

  dimension: email {
    type: string
    sql: ${TABLE}.email ;;
    description: "User's email address."
  }
}

Extended View

include: "/views/base/users.view"

view: users_extended {
  extends: [users]

  dimension: lifetime_value {
    type: number
    sql: ${TABLE}.ltv ;;
    description: "Total lifetime value of the user."
  }
}

Refinement (Layering)

include: "/views/users.view"

view: +users {
  label: "All Users (Refined)"
  
  dimension: email {
    # Adding a description to an existing field
    description: "Primary contact email."
  }
}

Reference Skills

  • Derived Tables: Standard (SDT) and Native (NDT) derived table patterns/materialization.

Comments

Markdown supported