Delete record data on doctype

Hello all,
I’m stuck trying to solve my case, which is I want to delete all the records in the doctype.

        doctype = 'AAM_QA_DMS_MASTER_ITEM'

all those not working. Pease help. Thankyou

you can write SQL query using

DELETE FROM table_name WHERE condition;

from bench mariadb

Thankyou for your response, but i want todo in custom script.


SMD is value of name.

thats my script delete for filter,
What if i want to delete all of them?

This will attempt to delete all documents of type DOCTYPE on your server:

doclist = frappe.db.get_all("DOCTYPE")
for doc in doclist:

@joeK try this

frappe.db.sql(""" TRUNCATE TABLE `tabSales Invoice` """)

Thank you for your help guys :pray: