Merge lp:~zeitgeist/zeitgeist/explain-logs into lp:zeitgeist/0.1
Proposed by
Mikkel Kamstrup Erlandsen
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 1583 | ||||
Proposed branch: | lp:~zeitgeist/zeitgeist/explain-logs | ||||
Merge into: | lp:zeitgeist/0.1 | ||||
Diff against target: | 0 lines | ||||
To merge this branch: | bzr merge lp:~zeitgeist/zeitgeist/explain-logs | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Markus Korn | Approve | ||
Review via email: mp+35334@code.launchpad.net |
Description of the change
Part 1) of our profiling quest can be merged now since it quite unintrusive and very useful in its own right
To post a comment you must log in.
Looks good, and it does not have to be perfect as it is for internal use only, but I'd like to avoid the 'print' statement and put it in a logging statement. This way it would be possible to redirect logging output of the 'zeitgeist.sql' domain to some file etc.
Proposed diff:
=== modified file '_zeitgeist/ engine/ sql.py' engine/ sql.py 2010-09-13 20:55:00 +0000 engine/ sql.py 2010-09-14 07:08:20 +0000
--- _zeitgeist/
+++ _zeitgeist/
@@ -38,9 +38,10 @@
def explain_ query(cursor, statement, arguments=()):
log.debug( "****** ******* ******* ******* ******* ******* *****") "QUERY: \n%s (%s)\nPLAN:" % (statement, arguments) ) execute( "EXPLAIN QUERY PLAN "+statement, arguments) .fetchall( ): "QUERY: \n%s (%s)\nPLAN:\n%s" % (statement, arguments, plan))
log.debug( "****** ******* ******* ******* ******* ******* *****")
- log.debug(
+ plan = ""
for r in cursor.
- print r
+ plan += str(list(r)) + "\n"
+ log.debug(
class UnicodeCursor( sqlite3. Cursor) :