Frappe.db.sql for updating rows

Hi to all,
is there the possibility to have the result of how many rows are changed after an update or insert into database using the function in object frappe.db.sql.

if not, is there another function that I can use passing sql string for doing this?

Thanks
Alessandro

Hi @alaurucci:

Try something like this …

def test_row_count():
    frappe.db.sql("""UPDATE tabToDo SET status='Closed' where status='Open';""")
    d = frappe.db.sql("""SELECT ROW_COUNT();""")[0][0]
    print(d)

Hope this helps.