LookML Development Practices
This document outlines the best practices for developing LookML models in the Data Team. #TODO review the practices with team
Naming Conventions
Measures:
- Use
number_prefix for count measures- Example:
number_of_users,number_of_transactions
- Example:
- Use
total_prefix for sum measures- Example:
total_amount,total_revenue
- Example:
Template Code for Common Links
User ID Link
Attempt ID Link
link: {
label: "Open in Hydra - KYC Attempt"
url: "https://hydra.majority.com/kyc/{{ view_name.user_id._value | url_encode }}/{{ value | url_encode }}"
}
Entity Token - Documents Tab Link
link: {
label: "Open in Alloy - Document"
url: "https://app.alloy.co/entities/{{ value }}/?tab=documents"
}
Adding a New Model
When adding a new model to Looker, complete these two configuration steps:
1. Configure Project Connection
- Go to Develop > Projects
- You'll see the new project is not configured
- Click Configure
- Save the
bq_majorityconnection
2. Update User Roles
- Go to Admin > Users > Roles
- Add the new model to the appropriate roles
- Typically add to
majority_userrole for standard users - Admins automatically have access to all models
Git Integration Setup
This guide explains how to configure your GitHub credentials for Looker so that your commits are attributed to your own GitHub account.
Prerequisites:
- A GitHub account with access to the relevant repositories
- A Looker account with developer permissions
Step 1: Create a GitHub Personal Access Token (PAT)
-
Click Generate new token
-
Configure the token:
Field Value Resource owner Select majority-dev(not your personal account)Note Looker Git IntegrationExpiration Choose based on your preference (e.g., 90 days) Repository access Select Only select repositories → dt-lookmlPermissions Under Repository permissions, set Contents to Read and write -
Click Generate token
-
Copy the token immediately — you will not be able to see it again
⚠️ Important: Treat this token like a password. Do not share it or commit it to any repository.
Step 2: Configure User Attributes in Looker
-
Log in to Looker
-
Click your profile picture (top right) → Account
-
Scroll down to the User Attributes section
-
Fill in the following attributes:
Attribute Value github_usernameYour GitHub username github_tokenThe PAT you created in Step 1 -
Click Save
Verification
After completing these steps, any commits you make through Looker will be attributed to your GitHub account. You can verify this by:
- Making a change in Looker's IDE
- Committing and pushing to a branch
- Checking the commit history on GitHub — it should show your username as the author
Token Renewal
Personal Access Tokens expire based on the expiration date you set. When your token expires:
- Create a new token following Step 1
- Update the
github_tokenuser attribute in Looker following Step 2
Consider setting a calendar reminder before your token expires.