Hi, Ophir. I think currently there's no way to to inject variable to %sql. I have created issue for it. https://issues.apache.org/jira/browse/ZEPPELIN-32 and it is implemented in https://github.com/apache/incubator-zeppelin/pull/27.
Please see https://www.youtube.com/watch?v=QdjZyOkcG_w https://github.com/apache/incubator-zeppelin/pull/27 has code for the video in the comment. Thanks, moon On Mon, Apr 6, 2015 at 3:22 AM Ophir Cohen <[email protected]> wrote: > Hi, > I'm trying to use the %sql with variable created beforehand and it does > not work. > > *My setup:* > 1. Zeppelin that runs on top of Spark in yarn-client mode with 4 nodes. > 2. Hive as the underneath layer, i.e. %sql goes to Hive metastore > > *This is what I want to achieve:* > 1. Collect table list and present it to the user on a dropdown > 2. When the user choose a table, it gets table's field list and present it > in a dropdown > 3. Then the user choose field a SQL query submitted something as follows: > *"select * from <choose table> order by <choose filed>"* > And present its results in table (same as return from %sql or %table). > > I encountered few problems: > 1. I couldn't 'inject' pre calculate variables into %sql statement. I > tried using println (that works for %table) but it does not work. > 2. I tried using %table. With that I have few problems: > 1. it does not work on the same box and I need to put it in the next > box (and its poor UX as the user need to choose in the first box and > than to run the next one to get the 'nice' table). > and > 2. I need to create the %table format (with tabs etc...) instead of > using direct %sql. > > > Hope I was clear... > > I guess the straight forward should have be a way to 'inject' variables > into %sql statement. > Is that possible? > > Thanks, > Ophir >
