Frappe.db.sql update issue

hi all ,

try to execute this query directly from terminal it’s work perfect , but when I place it into the code using frappe.db.sql. the table not effected and no errors popup

can anyone recheck it ?

frappe.db.sql(“”“update tabSales Person Commission t1, (select name, employee_name from tabSalary Slip where MONTHNAME(CURDATE())=MONTHNAME(start_date)) t2 set t1.salary_slip=t2.name where ifnull(salary_slip,‘’)=‘’ and t1.sales_person=t2.employee_name”“”)

thanks in advance
best regards

2 Likes

Hope you have added table name within accents
Have you added errprint in the code or debug=1 parameter in the frappe.db.sql?

@rohit_w thanks ,

yes the table is already in my db , I can’t find example for frappe.db.sql with debug=1 , can you give me one so I understand how to use it

thanks

frappe.db.sql(“”“update tabSales Person Commission t1, (select name, employee_name from tabSalary Slip where MONTHNAME(CURDATE())=MONTHNAME(start_date)) t2 set t1.salary_slip=t2.name where ifnull(salary_slip,‘’)=‘’ and t1.sales_person=t2.employee_name”“”, debug=True)

nothing in Error Log

solution is : write this after frappe.db.sql

frappe.db.commit()

thanks