Skip to main content

Set of tools for handling LookML files: a linter, updater, and grapher

Project description

Overview

Build Status PyPI pyversions PyPI version PyPI license Docs status

LookML Tools

This repository contains some tools to handle best practices of a set of developers working on LookML files.

There are three tools:

  • LookML updater
  • LookML linter
  • LookML grapher

Sites:

LookML updater

The first tool helps solve a problem of official definitions of dimensions and measures—such as in a business glossary—getting out of sync from some other system. The solution implemented here is to have a remote master list whose definitions are propagated to LookML. Thus, given some remote definition for a given LookML dimension, dimension_group, or measure, inject it in the LookML.

Full documentation is here.

LookML linter

The second tool helps us check that our LookML conforms to some given coding standards and LookML developer best practices. It runs a series of checks over our LookML files and reports which files, or which dimensions, dimension_groups, or measures, fail those checks.

Full documentation is here.

LookML grapher

The third tool creates a "network diagram" of the model - explore - view relationships and writes to an PNG image file. The code will also identify any orphans i.e. views not referenced by any models or explores.

Full documentation is here.

Installation

For the grapher, you will need to install grapviz:

brew install graphviz

For all tools, you will need to install dependencies:

  pip install -r requirements.txt

You can install the Python codebase of lookml-tools via pip:

  pip install lookml-tools

One user reported having to install a specific version of pandas (pandas==0.24.0) to make this all work. YMMV.

Alternatively, you can install with

  python setup.py install

Unit tests

There is a test suite with close to 100% code coverage

Run with

pip install pytest-cov

python -m pytest --cov=lkmltools/ test/*.py ; coverage html

Developer Notes

There are some developer notes for the linter here.

Contribute

We would love to have your feedback, suggestions, and especially contributions to the project. Create a pull request!

You can reach me directly at carl.anderson@weightwatchers.com as well as @leapingllamas on Twitter.

Release notes

2019-10-30: 2.0.5

added Travis CI config

2019-10-19: 2.0.4

pandas version change to support Python 3.7 (see https://github.com/ww-tech/lookml-tools/pull/5) Thanks for your contribution https://github.com/m-deck!

Grapher: title now exposed as an option

Grapher can now create animated GIFs

2019-09-28: 2.0.3

setup.py now uses find_packages()

2019-09-28: 2.0.2

Added missing init.py so that packages are recognized

2019-07-17: 2.0.1

Adding missing lkml to requirements.txt

2019-07-17: 2.0.0

Given the impact of the following two changes, this is a major release:

  • swapped out the node-based LookML parser with Josh Temple's new Python lkml parser (https://pypi.org/project/lkml/). This simplifies install, dependency management, and underlying parsed JSON format.
  • added layer of abstraction via LookML and LookMLField classes so that rules and other code can query LookML attributes via methods instead of inspecting raw JSON.

Other changes:

  • lkmltools.RuleFactory is now a singleton so it is easier for users to register their own rules.
  • Can now parameterize any rule in the configuration by adding additional keys to the dictionary for that rule. For instance, if the config defines {"name": "MyAwesomeRule", "run": true, "debug": true, "strict_mode":true, length: 6} then this whole dictionary is passed into the constructor during rule instantiation.

2019-06-10: 1.0.0

  • initial release

License

Copyright 2019 WW International, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lookml-tools-2.0.5.tar.gz (30.1 kB view details)

Uploaded Source

Built Distribution

lookml_tools-2.0.5-py3-none-any.whl (37.7 kB view details)

Uploaded Python 3

File details

Details for the file lookml-tools-2.0.5.tar.gz.

File metadata

  • Download URL: lookml-tools-2.0.5.tar.gz
  • Upload date:
  • Size: 30.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for lookml-tools-2.0.5.tar.gz
Algorithm Hash digest
SHA256 da086263e36050f985ec8b072e4edb861d67fb4eb163b267760ffc271f88e7ec
MD5 fba4b4ab3528cb80345af49d817550d2
BLAKE2b-256 3f565c295a5b4a9355dc4c7b5500c04b5420bb5f527b0befee8c0bb78a6a5121

See more details on using hashes here.

File details

Details for the file lookml_tools-2.0.5-py3-none-any.whl.

File metadata

  • Download URL: lookml_tools-2.0.5-py3-none-any.whl
  • Upload date:
  • Size: 37.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for lookml_tools-2.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 65f82b0bb3ba8450150cb00daf144a4a4537f84b4942199154d18065c3733931
MD5 1b2d55ff4e81ed64e0d8be895996eaac
BLAKE2b-256 2de92f8b10ca8760c828bd0be7db2d1e1b525c728d25ae58a4765327458f7108

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page