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?

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

@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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.