How to assign different values for different rows in a table using array

I’m fetching data from database using select query in py file and in js file im trying to add those data into a child table on a button click but whenever i click button im getting same data into into different rows. Please help me

py file


@frappe.whitelist()
def journey_details(name):
vars = frappe.db.sql(“”“SELECT from_date, to_date, leave_type, status
FROM tabLeave Application WHERE status != ‘Cancelled’ AND employee_name = %(name)s “””,{‘name’: name})
return vars

im confused how to iterate that array to store that data into child table

Array [

** Array(4) [ “2020-03-03”, “2020-03-07”, “Leave Without Pay”, “Approved”]**

** Array(4) [ “2020-03-13”, “2020-03-14”, “Leave Without Pay”, “Approved”]**

length: 2 ]