Hi,
How to Bulk Delete the Deleted Documents instead of one by one?
Any button and server script?
Hi,
How to Bulk Delete the Deleted Documents instead of one by one?
Any button and server script?
Thank you for your reply but if I have more than 60K entries, its a very time consuming task and it also consumes my daily time limit on Frappe Cloud.
In the file
/home/<erpnextUSER>/frappe-bench/apps/frappe/frappe/desk/doctype/bulk_update/bulk_update.py
you could temporarily change the limit of 500 to get a longer list but even if you DO know what youâre doing, it would be very dangerous.
Thanks, but deleting one by one is still a big task. There should be something like Delete All in Error Log
If you want to clear things in the error log, you can try thisâŚ
mysql -uroot -p -A;
#the -A speeds up opening the relevant DB
and then run the delete command something like below (tuned to your requirements[method like â%send_mail%â;] and with YOUR DBname[_fhjaeouy1oweyut9c4]. You can look in the table for a specific entry that you want to delete to figure out what the query should contain
use _fhjaeouy1oweyut9c4;
delete from `tabError Log` where method like '%send_mail%';
commit;
/q
@NCP
How safe is it to delete Deleted Documents
?
What about other tables? How safe is it to clear older records from some table like [version-12],
tabVersion
tabComment
tabRoute History
tabAccess Log
tabData Import
tabData Import Legacy
tabFile
tabActivity Log
tabEmail Queue Recipient
tabEmail Queue
tabOAuth Bearer Token
Also, thereâs thousands of Data Import Legacy records, with files; as they are successful, if we delete them, shall there be any issue?
and, whatâs __global_search
this has millions+ records?
First, sorry to reopen this thread after a year, but I find it important to give a proper solution here, this thread being the top Google search result when looking for âFrappe bulk deleteâ.
@Nitin_Chintamani
I propose to simply use Log Settings.
It allows to choose an expiration duration for most of the logs, including Email Queue, Deleted Documents, etcâŚ
For deleting the documents, just choose 1 day duration for the related doctype and wait a bit.
Any document older than the chosen duration will be automatically deleted in a clean way. In frappe version 15 more doctypes are available in log settings, but beware if you are using a site migrated from version 14 to version 15, you first need to delete the âError Snapshotâ row, it causes an issue as this doctype doesnât exist in version 15 anymore.
Btw if you want to delete any other doctype, using the system console if server scripts are enabled or the server console directly, this kind of script would do the trick without any broken link risks:
documents=frappe.get_list("YourDoctype",filters={"Your filters"}
for document in documents:
frappe.delete_doc(("YourDoctype",document.name)
Donât forget to check commit before executing if you use the system console or it wonât commit.
@fnrfarid
To answer your question, deleting deleted documents directly through SQL should not have any nefarious effect as logs documents are supposed to not be the target of any link, but any custom app,doctype or field could still target them.