Log query timing in src/Database.py in 1 line, not 2
This commit is contained in:
parent
06078ba959
commit
1ec6d0ad40
1 changed files with 2 additions and 3 deletions
|
@ -307,8 +307,6 @@ class Database(object):
|
||||||
fetch_func: typing.Callable[[sqlite3.Cursor], typing.Any],
|
fetch_func: typing.Callable[[sqlite3.Cursor], typing.Any],
|
||||||
params: typing.List=[]):
|
params: typing.List=[]):
|
||||||
printable_query = " ".join(query.split())
|
printable_query = " ".join(query.split())
|
||||||
self.log.trace("executing query: \"%s\" (params: %s)",
|
|
||||||
[printable_query, params])
|
|
||||||
start = time.monotonic()
|
start = time.monotonic()
|
||||||
|
|
||||||
cursor = self.cursor()
|
cursor = self.cursor()
|
||||||
|
@ -318,7 +316,8 @@ class Database(object):
|
||||||
|
|
||||||
end = time.monotonic()
|
end = time.monotonic()
|
||||||
total_milliseconds = (end - start) * 1000
|
total_milliseconds = (end - start) * 1000
|
||||||
self.log.trace("executed in %fms", [total_milliseconds])
|
self.log.trace("executed query in %fms: \"%s\" (params: %s)",
|
||||||
|
[total_millisecons, printable_query, params])
|
||||||
|
|
||||||
return value
|
return value
|
||||||
def execute_fetchall(self, query: str, params: typing.List=[]):
|
def execute_fetchall(self, query: str, params: typing.List=[]):
|
||||||
|
|
Loading…
Add table
Reference in a new issue