What is the best way to do model inheritance in the short-term while Looker doesn’t support it?
Already have an account? Login
Login to the community
No account yet? Create an account
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.
Daniel, can you give an example of what you’re trying to accomplish?
We have a staging model and a production model. They’re the same except with different connections. Currently we’ve put all of the explores into a file
explores.dashboard.lookmlbut I was wondering if there’s a way to put these explores into
explores.model.lookmlwithout getting all of the errors about a connection being required in that file.
We don’t put connection definitions in our models. (We may not be required to because we only have 1 connection.) However, a fast and potentially valuable experiment is to make a new model file. Then cut and paste the base view definitions into the new file. Make sure the new model file does NOT have a connection definition. Then change the two dependent models to include the new model file (but don’t redefine the baseviews). Have the connection information in the two dependent model files. Save everything and test it.
Because you can include model files in other model files this could solve your problem.
Yeah that’s fine. It’d be nice if this were sorted into the Models section of the UI, but not a high priority.
I was beginning to migrate to a similar process
@Daniel_Demetri, and had run into the slew of errors due to missing connections. I would like a better work around also, however this is what I ended up doing. Instead of using
.dashboard.lookml, I created new files and named them
.m.lookml. The nice thing is they show up in a separate area in the project under OTHER. Unfortunately they only can be initially created outside of Looker (via GitHub in my case).
The way I am actually using this is that I have multiple databases in production but only one is development. When pushing to production only the
.mfiles are copied and the static
.modelssimply handle the
A belated update to this topic, in Looker 3.24 we introduced the
extendsLookML parameter. In short, it allows one to build off of views, adding new fields and filters. It’s really slick, I encourage everyone to take a look at this tutorial.