Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

How to get variable value in %jdbc context

avatar
Super Collaborator

In zeppelin notebook, there are 2 paragraphs

In paragraph 1 - I have a python script which gets value from a rest-api call and assign it to a variable. I used z.put("var1",var) to set the variable.

In paragraph-2 , I am using %jdbc to run a sql query on a mysql table. e.g select abc from tb1 where name = '<variable>'

Question is - How can i pass var1 to the query and replace <variable> with value of var1. Any hints will be helpful

1 ACCEPTED SOLUTION

avatar
Super Collaborator

Its currently not possible as in zeppelin 0.6.

"Zeppelin's interpreter abstraction allows any interpreter creates something like Z context. To expose Z context to user in %jdbc interpreter, we need proper syntax for it. i.e. %spark interpreter expose Z context as scala api. %pyspark interpreter expose Z context as python api. %jdbc interpreter expose Z context as ..?"

Related defect - https://issues.apache.org/jira/browse/ZEPPELIN-1363

View solution in original post

1 REPLY 1

avatar
Super Collaborator

Its currently not possible as in zeppelin 0.6.

"Zeppelin's interpreter abstraction allows any interpreter creates something like Z context. To expose Z context to user in %jdbc interpreter, we need proper syntax for it. i.e. %spark interpreter expose Z context as scala api. %pyspark interpreter expose Z context as python api. %jdbc interpreter expose Z context as ..?"

Related defect - https://issues.apache.org/jira/browse/ZEPPELIN-1363