Number of rows obtained by each query is now printed.
This commit is contained in:
parent
51cd187cd2
commit
51c6a932dd
2 changed files with 10 additions and 1 deletions
8
CHANGELOG.MD
Normal file
8
CHANGELOG.MD
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Successful print message for each query will now also show the number of rows returned by the query.
|
||||||
|
|
||||||
|
|
@ -59,6 +59,7 @@ def measure_query_runtime(
|
||||||
cur = connection.cursor()
|
cur = connection.cursor()
|
||||||
cur.execute(query_to_measure.query_string)
|
cur.execute(query_to_measure.query_string)
|
||||||
rows = cur.fetchall()
|
rows = cur.fetchall()
|
||||||
|
obtained_rows = len(rows)
|
||||||
print(
|
print(
|
||||||
f"Query '{query_to_measure.name}' took {int(time.time() - start_time)} seconds to run."
|
f"Query '{query_to_measure.name}' took {int(time.time() - start_time)} seconds to run and returned {obtained_rows} rows."
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue