1

I am trying to create a simple dynamic form in Apache Zeppelin using Angular interpreter. I want to pass those values which are coming as input from the form in one notebook to a dynamic MySQL insert query in another notebook. Angular code as given below:

<form>
  1) Name: <input type="text" ng-model="firstname">
  </br></br>
  2) Give a rating for pack:
  <input type="radio" ng-model="myVar" value="Good">Good
  <input type="radio" ng-model="myVar" value="Average">Average
  <input type="radio" ng-model="myVar" value="Bad">Bad
  </br></br>
  3) Select a Region:
  <select ng-model="reg">
    <option value="">
    <option value="KNZ">KNZ
    <option value="Gauteng">Gauteng
    <option value="NorthEast">NorthEast
  </select>
</form>

This will create a dynamic form Click to see I want to execute an insert query(MySQL) in the next paragraph accessing the above variables "firstname", "myVar" and "reg" from angular dynamic form.

insert into Table (Firstname,Rating,Region) values ("firstname","myVar","reg")

Can anyone help me?

zgue
  • 3,793
  • 9
  • 34
  • 39

1 Answers1

1

You can use ZeppelinContext variables directly in jdbc interpreter by setting zeppelin.jdbc.interpolation property of the jdbc interpreter to 'true'

Example: %jdbc select * from test where country = '{country_code}'

Refer this link for more info

  • @SaravanElumalai Thank you. The link was really helpful. But my doubt is Dynamic form will be created only once i run the above angular code in a paragraph. In that form i will add the new variables then how the binding of angular variables will happen without executing anything. – Vishnu Mohan Sep 12 '18 at 11:06