Provide stack trace information in sql debug entries
|Reported by:||Owned by:||Philippe Raoult|
|Component:||Database layer (models, ORM)||Version:||master|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
when profiling django views I often use the list of stored SQL queries to review. What I am missing there is where each of the SQL statements comes from. So I added a stack frame text to each of them.
I have not measured the performance impact, but since it only affects installations with DEBUG=True, I consider the tradeoff acceptable.
The patch also simplifies the debug entry by splitting off the storing to a separate method save_entry().