Lookml model

From Kilo-Org/kilo-marketplace · View interactive version

Lookml model is an AI agent skill from the GitHub repository Kilo-Org/kilo-marketplace. Use this skill when you need to create or modify a LookML Model file (.model.lkml). This includes defining connections, includes, and configuring model-level settings.

How to use this skill

Skill file

Instructions

  1. Define the Model File: A model file generally corresponds to a single database connection and includes Explores.
  2. Required Parameters:
  1. Best Practices:

4. Datagroups & Caching

Datagroups are the preferred mechanism for managing caching policies.

Datagroups vs `persist_for`

| Feature | Datagroups (Recommended) | persist_for |

| :------------- | :----------------------------------------- | :------------------------------------ |

| Trigger | SQL Query (Smart) | Fixed Time (Dumb) |

| Alignment | Aligns with ETL/ELT completion | Misaligned (guesswork) |

| Management | Centralized in Model file | Scattered in Explores/Models |

| Use Case | Production dashboards, ETL synchronization | Ad-hoc queries, Real-time (<1h) needs |

[!TIP]

Use persist_for ONLY for real-time dashboards where you need to force a cache refresh every X minutes (e.g., stock tickers, fast-moving inventory). For everything else, use Datagroups.

5. Include Patterns

Use strict patterns to control scope and performance.

| Pattern | Description | Use Case |

| :--- | :--- | :--- |

| include: "/views/*.view" | All views in specific folder | Standard modularity |

| include: "/views/marketing/users.view" | Specific file | Precise control, avoids conflicts |

| include: "/**/*.view" | Recursive (all views in project) | Avoid unless small project |

| include: "/dashboards/*.dashboard" | All dashboards in folder | Importing dashboards |

Examples

Basic Model

connection: "thelook"

# Include all views in the views/ folder
include: "/views/*.view"

# Include all dashboards
include: "/*.dashboard"

# Define an Explore (usually better to define in separate files for large projects, but acceptable here for small ones)
explore: orders {
  join: users {
    type: left_outer
    sql_on: ${orders.user_id} = ${users.id} ;;
    relationship: many_to_one
  }
}

Model with Specific Settings

connection: "snowlooker"

label: "eCommerce Analytics"

# Set valid week start day
week_start_day: monday

# Include specific folders
include: "/views/finance/*.view"
include: "/views/marketing/*.view"

## Model with Datagroup (Best Practice)

connection: "thelook"

Define the caching policy

datagroup: ecommerce_etl {

description: "Triggers when the max created_at date changes in the events table."

sql_trigger: SELECT MAX(created_at) FROM project.dataset.events ;;

max_cache_age: "24 hours" # Fallback

}

Apply default caching to all Explores in this model

persist_with: ecommerce_etl

include: "/views/*.view"

explore: orders {

# This explore inherits 'persist_with: ecommerce_etl' from the model default

}

explore: real_time_dashboard {

# Override with a different policy if needed

persist_for: "5 minutes"

}

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.