LookML Generator for Glean and Mozilla Data
Перейти к файлу
Frank Bertsch 7780fb0669 Update README.md 2021-05-24 10:35:59 -04:00
.circleci Update GCP/GCR orb to 0.13.0 (fixes #124) 2021-05-21 07:20:02 -04:00
.github Tag group for review on dependabot PRs 2021-05-18 13:59:01 -04:00
architecture Add architecture images 2021-02-08 11:53:40 -05:00
bin Use new allowlist file for generation 2021-05-12 10:33:03 -04:00
generator Bug 1707727 - Publish namespaces.yaml to GitHub alongside generated lookml (#122) 2021-05-20 14:28:29 -07:00
tests Bug 1707727 - Publish namespaces.yaml to GitHub alongside generated lookml (#122) 2021-05-20 14:28:29 -07:00
.flake8 Add links to generated measures 2021-05-05 13:33:50 -04:00
.gitignore Add .env to .gitignore 2021-05-05 13:33:50 -04:00
.isort.cfg Generate namespaces.yaml (#9) 2021-03-08 13:45:24 -08:00
.pre-commit-config.yaml Add mypy to list of pre-commit hooks (#80) 2021-05-03 14:15:12 -07:00
.yamllint.yaml Add circlci config for deploy 2021-04-19 13:50:45 -04:00
Dockerfile Pin alpine version too 2021-05-18 13:14:03 -04:00
GENERATION_DISALLOW_LIST Add firefox_ios to allowlist; don't generate all views 2021-05-03 19:13:15 -04:00
LICENSE Initial commit 2021-02-08 11:21:24 -05:00
Makefile WIP: Script and infra for LookML generation 2021-04-19 13:50:45 -04:00
README.md Update README.md 2021-05-24 10:35:59 -04:00
custom-namespaces.yaml Add numbers_that_matter namespace (#69) 2021-04-28 16:24:59 -07:00
docker-compose.yml Remove GCLOUD_SERVICE_KEY 2021-04-26 11:30:53 -04:00
namespaces-allowlist.yaml Enable bergamot 2021-05-12 14:19:18 -04:00
netlify.toml Bug 1707727 - Test generation of namespaces.yaml and make it available in deploy preview (#92) 2021-05-18 10:25:41 -07:00
pytest.ini Generate namespaces.yaml (#9) 2021-03-08 13:45:24 -08:00
requirements.in Bump click from 8.0.0 to 8.0.1 (#120) 2021-05-20 16:44:45 +00:00
requirements.txt Bump google-api-core dependency (#123) 2021-05-20 17:25:41 -04:00
setup.py Finalize container and script to publish LookML 2021-04-19 13:50:45 -04:00

README.md

lookml-generator

mozilla Under Active Development

LookML Generator for Glean and Mozilla Data.

The lookml-generator has two important roles:

  1. Generate a listing of all Glean/Mozilla namespaces and their associated BigQuery tables
  2. From that listing, generate LookML for views, explores, and dashboards and push those to the Look Hub project

Generating Namespace Listings

At Mozilla, a namespace is a single functional area that is represented in Looker with (usually) one model*. Each Glean application is self-contained within a single namespace, containing the data from across that application's channels. We also support custom namespaces, which can use wildcards to denote their BigQuery datasets and tables. These are described in custom-namespaces.yaml.

alt text

* Though namespaces are not limited to a single model, we advise it for clarity's sake.

Generating LookML

Once we know which tables are associated with which namespaces, we can generate LookML files and update our Looker instance.

Lookml-generator generates LookML based on both the BigQuery schema and manual changes. For example, we would want to add city drill-downs for all country fields. alt text

Setup

Ensure Python 3.8+ is available on your machine (see this guide for instructions if you're on a mac and haven't installed anything other than the default system Python.)

Install requirements in a Python venv

python3.8 -m venv venv/
venv/bin/pip install -r requirements.txt

Update requirements when they change with pip-sync

venv/bin/pip-sync

Setup pre-commit hooks

venv/bin/pre-commit install

Run unit tests and linters

venv/bin/pytest

Run integration tests

venv/bin/pytest -m integration

Container Development

Most code changes will not require changes to the generation script or container. However, you can test it locally. The following script will test generation, pushing a new branch to the looker-hub repository:

export HUB_BRANCH_PUBLISH="yourname-generation-test-1"
export GIT_SSH_KEY_BASE64=$(cat ~/.ssh/id_rsa | base64)
make build && make run

Deploying new lookml-generator changes

lookml-generator runs daily to update the looker-hub and looker-spoke-default code. Changes to the underlying tables should automatically propogate to their respective views and explores.

However, changes to lookml-generator need to be tested on stage and deployed. The general process is the following:

  1. Create a PR, test on dev. It is not necessary to add Looker credentials, but the container changes should run using make build && make run, with changes reflected in LookML repos.
  2. Once merged, the changes should run on stage. They will run automatically after schema deploys, but they can be run manually by clearing the lookml_generator_staging task in Airflow.
  3. Once the changes are confirmed in stage, we first tag a new release here. Add a description with what the new release includes. Finally, change the Airflow variable lookml_generator_release_str to the version string you created when cutting the release. Re-run the DAG and the changes should take effect.