Generate Looker LookML View Files
Creates LookML view files for Looker with dimensions, measures, derived tables, and performance-optimized SQL.
Why it matters
Automate the creation of LookML view files for Looker, ensuring best practices in data modeling, SQL optimization, and BI reporting.
Outcomes
What it gets done
Generate core LookML view structures including dimensions, measures, and derived tables.
Implement best practices for time, categorical, and geographic dimensions.
Create advanced measures like conditional aggregations and running totals.
Optimize view performance through proper indexing, primary keys, and efficient filtering.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-looker-view-generator | bash Overview
Looker View Generator
Creates LookML view files for Looker covering dimensions, measures, derived tables, and performance-optimized SQL patterns. Use when writing or optimizing a Looker view, adding measures or dimensions, or building a derived table for complex logic.
What it does
Creates LookML view files for Looker - covering dimensional modeling, measure calculations, derived tables, and SQL patterns structured for query performance and business-user usability.
When to use - and when NOT to
Use this skill when writing a new Looker view from a database table, adding measures or dimensions to an existing view, building a derived table for cohort or other complex logic, or optimizing a slow-performing view. Not a fit for building Looker Explores/dashboards themselves (this generates view-level LookML, not dashboard layout) or for BI tools other than Looker. The guidance is framed around end-user experience and query performance as the two considerations that should drive every view design decision.
Inputs and outputs
Every view follows a fixed structure: connection and table declaration, a primary key dimension, dimensions, measures, derived tables where needed, and field documentation. A basic view template shows sql_table_name, a primary key dimension, a dimension_group for timestamps with multiple timeframes, a string dimension with a drill-through link to a dashboard, count and sum measures, and a set grouping fields for drill fields.
Dimension patterns include dimension_group for time fields with explicit timeframes and timezone handling, categorical dimensions using case blocks to map raw codes to business labels, and geographic dimensions using map_layer_name and sql_latitude/sql_longitude for location types.
Measure patterns include conditional measures with filters, ratio measures like conversion rate using NULLIF to guard against division by zero, running_total and percent_of_total measure types for window-function-style aggregation, and a derived table example computing user cohorts by first-order month with sql_trigger_value for incremental rebuilds.
Performance guidance covers always defining primary keys for join performance, schema-qualifying sql_table_name, efficient yesno filter dimensions for quick filtering, and a default date-range filter. A data quality measure example combines a percent-formatted score with conditional HTML/Liquid coloring (green/orange/red) based on the value.
Integrations
Generates LookML for the Looker BI platform, targeting SQL-based warehouse tables and using Looker-specific constructs (dimension_group, derived_table, sql_trigger_value, Liquid templating in html fields).
Recommendations it follows
Use descriptive names matching business terminology, document every field for business users, define logical drill paths, apply appropriate value formats (currency, percent, decimal places), use efficient SQL patterns while avoiding unnecessary calculations, validate measures against known results before deployment, apply appropriate caching strategies for derived tables, and implement access grants for sensitive data.
Who it's for
Analytics engineers and BI developers building or maintaining Looker views who need correct LookML structure, measure patterns, and derived-table logic rather than a general SQL or dashboard-design guide.
measure: conversion_rate {
type: number
sql: 1.0 * ${converted_users} / NULLIF(${total_users}, 0) ;;
value_format_name: percent_2
}
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.