Best Practices for Looker Development: A Practical Guide for Data Teams
When building and maintaining Looker projects, the difference between a smooth, scalable setup and a tangled mess often comes down to following the right practices from day one. Whether you are a Looker developer or part of a data engineering team, applying these best practices can help you avoid costly mistakes, keep your code maintainable, and deliver consistent, reliable insights.
Below, we will cover six critical areas: LookML Project & Git Integration, Dimension & Measure Modeling, Code Organization & Readability, Explore Modeling & Joins, Derived Tables, and Caching & Datagroups.
💡 To check our previous blogs about Looker, click here.
1. LookML Project & Git Integration
Looker’s Git integration is more than just a convenience; it is the backbone of version control and collaboration in LookML projects. Here is how to make the most of it:
- One project = one Git repo
Maintain a one-to-one mapping between your LookML project and its dedicated Git repository. This makes version control simpler and reduces merge conflicts.
|
💡 LookML Project: A LookML project is the collection of LookML files (views, models, dashboards, etc.) that define your Looker environment. It is essentially the codebase for your Looker data model. 💡 Git Repository: A Git repository is where your LookML project’s code is stored and versioned. In Looker, this enables collaboration, rollback, and proper version control. |
- Always pull before you push
In Development Mode, pull the latest changes from production before editing. This ensures you are working with the most up-to-date version of all files.
|
💡 Development Mode: A personal workspace in Looker where you can safely make and test changes to LookML without affecting the production environment. |
- Write meaningful commit messages
A short comment explaining your changes can save hours of confusion later. Be clear and descriptive.
- Review before deploying
Test your changes in Explore before pushing them to production. This helps catch errors early.
|
💡 Explore: An Explore is the user-facing interface in Looker where you can query data based on your LookML models. It is also where you validate your development changes before deploying. |
- Run Project Health checks
Always run Looker’s Project Health tests before deployment to avoid broken content or performance issues.
|
💡 Project Health Tests: Built-in Looker validations that scan your LookML for common issues such as syntax errors, broken references, or missing fields. |
2. Dimension & Measure Modeling
Modeling is where LookML’s flexibility shines, but it is also where inconsistent naming, hard-coded logic, or poor structuring can lead to future headaches. Follow these practices to keep your modeling clean and scalable:
- Use
${field_name}, not${TABLE}
When building new dimensions based on existing ones, reference them with${field_name}. This avoids hard-coded column names and ensures your new fields inherit any transformations or logic.
Example:
dimension: full_name{ sql: concat(${first_name}, " ", ${last_name}) ;; }
|
|
💡 💡 |
- Avoid redundant names in time dimensions
Fordimension_group: type: time, do not add “date” or “time” in the name. Keep it clean.
|
💡 Dimension Group: A set of related fields (dimensions) generated from a single column, such as multiple time intervals (day, week, month) created from a date field. |
- Use duration dimension groups
Instead of manually calculating date differences insql, createtype: durationdimension groups. This gives business users flexible time intervals and adapts better if the source changes.
- Follow a consistent naming convention
Use lowercase letters and underscores for field names (full_name, total_sales). LookML is case-sensitive, so consistency matters.
- Keep the semicolons
Always leave the two;;at the end of SQL expressions inside thesqlparameter. This signals where the SQL ends.
- Validate as you build
Keep one Explore tab open in Development Mode. After each change, refresh to quickly confirm it works as expected.
3. Code Organization & Readability
Keeping your LookML code clean and organized makes it easier for your team to maintain and scale.
- Order fields logically
While not strictly enforced, place new dimensions or measures after existing ones in the view file to keep related fields together.
- Use clear dashboard filenames
Follow the conventionname.dashboard.lookmlfor LookML dashboard files. This helps with quick identification and consistency.
4. Explore Modeling & Joins
Explores are the heart of Looker, and getting their structure right impacts both performance and usability.
- Prefer direct joins from the base view
Use a join key from the base view when possible to avoid the performance costs of indirect joins.
- Always define a primary key
Setprimary_key: yesin every view, even if it is not currently being joined in an Explore. This enables symmetric aggregation.
|
💡 💡 Symmetric Aggregation: A Looker optimization that ensures measures aggregate correctly even when joined views have different levels of granularity. |
- Specify relationships correctly
For every join, set therelationshipparameter accurately to ensure correct aggregation results.
|
💡 relationship Parameter: Defines how a join should behave in an Explore |
5. Derived Tables
Derived tables can be powerful, but they require disciplined setup to avoid future headaches.
For SQL Derived Tables (via SQL Runner):
- Move the new view file to the
viewsfolder. - Remove any
LIMITclauses used for testing. - Hide unnecessary auto-generated count measures or remove them entirely.
- Define a
primary_keyfor the view (e.g.,primary_key: yesfororder_idinorder_facts).
|
💡 SQL Derived Table (SDT): A view in Looker created from custom SQL queries instead of a physical table in your database. |
For Native Derived Tables (NDTs):
- Create a new view for each NDT.
- Move the new view file to the
viewsfolder. - Rename the auto-generated view name to match the view file name.
- Leave the model file reference commented out to prevent circular dependencies.
|
💡 Native Derived Table (NDT): A view in Looker created directly in LookML using |
For Persistent Derived Tables (PDTs):
- Use a dedicated schema in your database for PDTs (e.g.,
X_scratch). - Prefer
datagroup_triggerif datagroups are already defined. - If using
persist_for, pair it withsql_trigger_valueor use either on its own for data freshness. - For cascading PDTs with the same
datagroup_trigger, Looker will handle dependency order automatically. - Add indexing to PDTs for faster query performance.
|
💡 Persistent Derived Table (PDT): A derived table stored in your database for faster queries. PDTs can be refreshed on a schedule or triggered by datagroups. |
6. Caching & Datagroups
Caching is essential for performance, and datagroups are the key to controlling it effectively.
- Use both parameters in datagroups
Define bothmax_cache_ageandsql_triggerfor reliable caching with a fallback mechanism.
|
💡 💡 |
- Link PDTs to datagroups
Apply thedatagroup_triggerparameter to PDTs to keep data up to date.
|
💡 |
- Know the limits with dynamic usernames
If your connection uses dynamic usernames (e.g., BigQuery OAuth), datagroups and PDTs are not supported. In this case, usepersist_forto cache Explore queries for a set duration.
Business Use Case: Building a Regional Sales Performance Dashboard in Looker
|
The Scenario: Your company operates in multiple countries, and the sales leadership team wants a Regional Sales Performance Dashboard in Looker. This dashboard should allow managers to:
The data model will combine three main sources:
|
How to Approach It1. Set up the LookML Project and Git Integration
2. Model the Views and Explores
3. Join the Data
4. Optimize with Derived Tables
5. Build the Dashboard
6. Test and Deploy
|
⭐⭐⭐
Looker is a powerful platform, but its true potential comes from disciplined, consistent development practices. From Git integration and field modeling to Explore joins, derived tables, and caching strategies, every best practice you follow adds up to a cleaner, faster, and more scalable analytics environment. By standardizing these approaches, your team can work more efficiently, reduce errors, and deliver insights your business can trust, today and as your data needs evolve.
If you are ready to take your Looker development to the next level, contact us today. We will help you implement these best practices and build an analytics foundation that grows with your business.
Author: Umniyah Abbood
Date Published: Aug 19, 2025
