mcpField
L
lookml-sets

lookml-sets

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

About lookml-sets

lookml-sets is a reference skill on defining and using reusable field lists in LookML. It is for Looker modelers who need to organize drill paths and control field visibility across Explores.

Key features

  1. 01Defines reusable field lists
  2. 02Composes sets with inclusion and exclusion
  3. 03Supports drill-field configuration
  4. 04Controls Explore field visibility
  5. 05Covers cross-view references and naming

Use cases

  1. 01Reuse field groups across a LookML model
  2. 02Configure fields shown in an Explore
  3. 03Set fields available for measure drill-down

Install

Copy the command and run it in a terminal.

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

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

Details

From the project README

LookML Sets

Sets are reusable lists of fields (dimensions, measures, and filters) defined within a view or a model. They are primarily used to group fields together for various purposes such as drill-down paths, explore field visibility, and more.

Syntax

set: set_name {
  fields: [field_name1, field_name2, view_name.field_name3, ...]
}
Key Features
  • Reusability: Define a list of fields once and use it in multiple places.
  • Composition:
    • Include All: [set_name*] includes all fields from another set.
    • Exclude: [-field_name] excludes a specific field.
    • External Reference: view_name.set_name* refers to a set in another view (ensure views are joined).

Use Cases

1. Drill Fields (Primary Use Case)

Sets are the standard way to define what happens when a user clicks on a measure value. Instead of listing fields repeatedly, define a set and reference it.

view: orders {
  # ... dimensions ...

  set: order_details {
    fields: [id, created_date, status, user.email]
  }

  measure: count {
    type: count
    drill_fields: [order_details*]
  }
}
2. Controlling Explore Visibility (Field Picker)

You can use sets at the Explore level to explicitly define which fields are visible to users. This is best practice for curating Explores.

explore: orders {
  fields: [ALL_FIELDS*]         # Start with everything (default)
  # OR
  fields: [orders.order_details*, users.user_info*] # Whitelist specific sets
}
3. Excluding Fields

Use sets to exclude specific fields from an Explore without hiding them at the view level (which hides them globally).

explore: orders {
  fields: [ALL_FIELDS*, -users.password_hash]
}

Best Practices

1. The detail Set

Every view should ideally have a default set (commonly named detail or drill_set) that includes the most relevant fields for drilling into a record from that view.

view: users {
  dimension: id { primary_key: yes ... }
  dimension: name { ... }
  dimension: email { ... }

  # Standard set for drilling
  set: detail {
    fields: [id, name, email]
  }
}
2. Naming Conventions
  • Use snake_case for set names.
  • Use descriptive names like user_info, financial_metrics, drill_detail.
3. Avoid Cross-View Dependencies in View Sets

While you can reference other_view.field in a view's set, this creates a dependency. Ensure that other_view is always joined whenever the set is used.

  • Better: Define sets local to the view (only its own fields).
  • Explore Level: Combine sets from different views at the Explore level (e.g., fields: [orders.detail*, users.detail*]).
4. Cumulative Sets

You can build sets on top of other sets.

set: basic_info {
  fields: [id, name]
}

set: extended_info {
  fields: [basic_info*, email, created_date]
}

Comments

Markdown supported