I was looking for the same, in the end I opted for using the Scala binding
to create the final string for the sqlContext.sql(queryString). For example:

val inputStr = z.input("formName", "defaultValue").toString()

val inputSelectStr  = z.select("formName", "defaultValue", Seq(("option1",
"optionDefaultValue1"), ("2", "2"),("3", "3"))).toString()

// PERFORM QUERY

val df = sqlContext.sql("SELECT id, name, user_preference FROM table WHERE
name like '" + inputStr + "' AND user_preference ="
+ inputSelectStr.mkString(" "))

Hope it helps,

Jose



On 25 June 2015 at 14:27, Ophir Cohen <oph...@gmail.com> wrote:

> Thanks for the answer.
> I saw that, but it isn't what I look for.
>
> I would be happy to do the same, i.e. taking this line:
> println("Hello " + z.input("name))
> And use something similar on the %sql interpreter, something like:
> %sql select * from z.select(getTableList())
>
> On Thu, Jun 25, 2015 at 12:44 PM, IT CTO <goi....@gmail.com> wrote:
>
>> I am not sure this is what you are asking for but look at the last
>> paragraph on dynamic form page
>> http://zeppelin.incubator.apache.org/docs/dynamicform.html
>> Creates Programmatically
>>
>> Some language backend uses programmatic way to create form. For example
>> ZeppelinContext
>> <http://zeppelin.incubator.apache.org/docs/interpreter/spark.html#zeppelincontext>
>>  provides
>> form creation API
>>
>> Here're some examples.
>>
>> On Thu, Jun 25, 2015 at 12:40 PM Ophir Cohen <oph...@gmail.com> wrote:
>>
>>> Hi Guys,
>>> A question regarding dynamic forms and %sql
>>>
>>> I would like to be able to create dynamic form on %sql but to get values
>>> in run time i.e.
>>> Instead of this:
>>>
>>> %sql
>>> select * from ${table_name=table1,table1|table2|table3}
>>>
>>> Do something as follows:
>>>
>>> %sql
>>> select * from ${table_name=table1,${getTableList()}}
>>>
>>> Assuming I have getTableList() method that returns list of the tables.
>>>
>>> I couldnt find any option to do so...
>>> I implmented something using println but that makes me create the table
>>> by myself...
>>>
>>> Thanks,
>>> Ophir
>>>
>>>
>

Reply via email to