Redshift distribution style warnings solution

Hi all,

We use redshift with looker and have the validation before commit on the warning level to ensure high quality code in our main branch. This meant this morning that noone in our team was able to commit anything as the distribution style came straight in at warning leaving us with 190 views to fix before anything else could be done.

In the spirit of helping out others in the same boat, I thought I’d share the solution we used to resolve this. I cloned my dev branch to my file system using git and then used the python library ruamel.yaml to parse all of the view lookml files, added a distribution_style to those that needed them and then save the resulting yaml back to file. Finally I synced the updates with my dev branch, tested them and merged them into production.

The only real downside is that doing this will reformat all of your view files, but we thought this a better price than doing it by hand!

(disclaimer: I didn’t write the library, just found it useful here)

Hope this helps


EDIT: Added the word python

0 replies

Be the first to reply!