• 13 April 2020
  • 0 replies

Userlevel 3

I’d like to announce the release of pyLookML, the batteries included toolkit for scripting LookML.

It leverages the awesome lkml parser written by Josh Temple, but expands on it by offering an OO interface, integration with github or any git service, scripting syntax, convenience functions / macros, querying views for fields with specific parameter conditions, child-dependency tracing and more.

You can get started by doing pip install lookml (create it in a virutalenv of course!)

Visit the project documentation here

Here is an example script solving the age old EAV schema issue: here

Here is a short cookbook of things you can do with it: here

And of course, let me know if you have any questions!

File bugs and feature requests here

Here is a small code sample demonstrating some of what’s possible:

import lookml

proj = lookml.Project(
repo= "llooker/pyLookMLExample",
#Optional args for the deploy URL (for deploying directly to production mode)

viewFile = proj.file('01_order_items.view.lkml')
order_items = viewFile.views.order_items

for field in order_items.sale_price.children():

>>> ${min_sale_price}
>>> ${max_sale_price}
>>> ${total_sale_price}
>>> ${average_sale_price}

...#Change something = 'no'
#writes back to github
#hits the deploy url

Will follow up here with additional recipes and blocks over time you can start adding to your workflows!

0 replies

Be the first to reply!