fix: converted query to qb

This commit is contained in:
Jannat Patel
2023-01-04 16:57:35 +05:30
parent ec31c96120
commit 281af15d65

View File

@@ -2,9 +2,9 @@ import frappe
def execute():
rows = frappe.db.sql(
"select field from `tabSingles` where doctype='User'", as_dict=True
)
table = frappe.qb.DocType("Singles")
q = frappe.qb.from_(table).select(table.field).where(table.doctype == "User")
rows = q.run()
if len(rows):
frappe.db.sql("delete from `tabSingles` where doctype='User'")
frappe.db.delete("Singles", {"doctype": "User"})