fix: Use query.run to execute query instead of db.sql

This commit is contained in:
Gavin D'souza 2022-04-19 19:06:43 +05:30
parent 0dac379bc8
commit 08402a76f1

View file

@ -1174,12 +1174,11 @@ class Database(object):
Doctype name can be passed directly, it will be pre-pended with `tab`.
"""
values = ()
filters = filters or kwargs.get("conditions")
query = self.query.build_conditions(table=doctype, filters=filters).delete()
if "debug" not in kwargs:
kwargs["debug"] = debug
return self.sql(query, values, **kwargs)
return query.run(**kwargs)
def truncate(self, doctype: str):
"""Truncate a table in the database. This runs a DDL command `TRUNCATE TABLE`.