Happy to share some thoughts here. I did not find an easy way to do this for 
postgres/psql or other interpreters. Here is what I did using the spark 
interpreter.

I am not doing drill down via html links, but via select/drop drown list. 
Hopefully you can do something for links. 

Here is the angular API for zeppelin:
https://zeppelin.apache.org/docs/0.6.2/displaysystem/back-end-angular.html 
<https://zeppelin.apache.org/docs/0.6.2/displaysystem/back-end-angular.html>
https://zeppelin.apache.org/docs/0.6.2/displaysystem/front-end-angular.html 
<https://zeppelin.apache.org/docs/0.6.2/displaysystem/front-end-angular.html>

In my use case, I have a book with 6 paragraphs, which use angular variables. 
For example in the first paragraph, I have the following:

// Create a select/drop down list of hosts
var hostList: List[(String, String)] = Nil
…..
val selectedHost =  z.select("Select a host for analysis", hostList)

// Bind the selected hosts to an angular variable
z.angularBind("selectedHost", selectedHost)

In the 6th/last one, I have this code which runs the angular watch API, to 
detect and refresh the 4 key paragraphs when the variable changes.

%spark
val selectedOptionContext = z.getInterpreterContext()
def myWatcher0(before:Object, after:Object) {
    z.run(1, selectedOptionContext)
    z.run(2, selectedOptionContext)
    z.run(3, selectedOptionContext)
    z.run(4, selectedOptionContext)
}
z.angularWatch("selectedHost", myWatcher0 _)

Hope this helps. There might be better ways of doing this and I’d like hear 
thoughts from others.


> On Mar 31, 2017, at 6:11 PM, murexconsult...@googlemail.com wrote:
> 
> I am trying to create a drill down in Zeppelin on some data. Taking the bank 
> data in the example I have this paragraph:
> 
> %sql
> select concat('%html <a>',job,'</a>'), 
> sum(balance),avg(balance) from bank
> group by job order by job
> 
> Which displays the data I want. But was trying to get the next paragraph to 
> update when I click on each of the links - say retired:
> 
> %sql
> select marital, sum(balance) from bank where job='${type=sevices}'
> group by marital
> 
> 
> i.e. I wanted the variable type be updated and then the paragraph run when 
> someone clicks on each link in the previous paragraph.
> 
> I can see if I use %angular I should be able to do this. But that does not 
> work in the cell of a table. And cannot get the <a> tag to work - tried a few 
> on-click etc...
> 
> Is this possible?  Guess other approach would be to not return a table but an 
> %angular and do all the formatting with <table> in that?
> 
> Any tips or clues would be helpful.
> 
> Thanks
> 

Reply via email to