django-sql-explorer icon indicating copy to clipboard operation
django-sql-explorer copied to clipboard

count is not coming correct in log in `truncate_querylogs`

Open bhola-kr-1004 opened this issue 1 year ago • 0 comments

Hi,

in explorer.tasks.snapshot_queries func, inside logger, it's written as

logger.info(
    f"Deleting {qs.count} QueryLog objects older than {days} days."
)

Code link

Which results in log output as. Deleting <bound method QuerySet.count of <QuerySet [<QueryLog: QueryLog object (2585296)>, <QueryLog: QueryLog object (2585295)>, <QueryLog: QueryLog object (2585294)>, <QueryLog: QueryLog object (2585293)>, <QueryLog: QueryLog object (2585292)>, <QueryLog: QueryLog object (2585291)>, <QueryLog: QueryLog object (2585290)>, <QueryLog: QueryLog object (2585289)>, <QueryLog: QueryLog object (2585288)>, <QueryLog: QueryLog object (2585287)>, <QueryLog: QueryLog object (2585286)>, <QueryLog: QueryLog object (2585285)>, <QueryLog: QueryLog object (2585284)>, <QueryLog: QueryLog object (2585283)>, <QueryLog: QueryLog object (2585282)>, <QueryLog: QueryLog object (2585281)>, <QueryLog: QueryLog object (2585280)>, <QueryLog: QueryLog object (2585279)>, <QueryLog: QueryLog object (2585278)>, <QueryLog: QueryLog object (2585277)>, '...(remaining elements truncated)...']>> QueryLog objects older than 60 days.

I assume that the log output should be as, Deleting 100 QueryLog objects older than 90 days. assuming count as 100, days as 90.

Is my assumption correct? if yes, can I add the fix?

Thanks, Bhola

bhola-kr-1004 avatar Jul 03 '24 20:07 bhola-kr-1004