Is extends really code reuse

kuopaz
New Member

I quite often find that I don’t want to ‘extend’ an existing explore, rather I want to ‘use’ an existing explore in a new explore. I don’t see how the LookML extends: [ ] can do this, which would be true code reuse.

0 9 937
9 REPLIES 9

Why do you think you can’t use extends?

kuopaz
New Member

If I create a VIEW in SQL that joins a number of tables, I can use that view as a virtual table *anywhere* in a future query and it’s joins. Can I use extends on explores to do the same?

Yes, you can extend an explore, use it as a base, and then add other joins if you’d like or configure other joins, override its settings, and so on..

kuopaz
New Member

I want to be able to do something like the following:

explore: a {

join…

join...

}

explore: b {

join...

join: a

}

Explore is not a CTE so you can’t use it as a join. Now I kow what you mean. And no, you can’t just reuse parts of the code in all the places

kuopaz
New Member

Thanks for the confirmation. Perhaps I’m really asking for an ‘explore to explore join’ that is currently done by merge in Looker - but cannot be done in LookML.

extends is a specific form of code reuse.

Look into native derived tables

kuopaz
New Member

Thanks. Yes, believe native derived tables can provide ‘real’ code re-use. But ideally it would be possible without introducing native DTs - and having to learn something else...

Hi @kuopaz 

Have you managed to solve this as I am in a similar predicament.

as the Existing Explores have all the necessary joins and definitions how does a native derived table achieve this?

Top Labels in this Space
Top Solution Authors