Code review comment for lp:~zeitgeist/zeitgeist/explain-logs

Revision history for this message
Markus Korn (thekorn) wrote :

I'm not sure, but maybe the queries are more readable if we replace '?' by the actual values:

=== modified file '_zeitgeist/engine/sql.py'
--- _zeitgeist/engine/sql.py 2010-09-13 20:55:00 +0000
+++ _zeitgeist/engine/sql.py 2010-09-14 07:40:46 +0000
@@ -38,9 +38,11 @@

 def explain_query(cursor, statement, arguments=()):
        log.debug("**********************************************")
- log.debug("QUERY:\n%s (%s)\nPLAN:" % (statement,arguments))
+ plan = ""
        for r in cursor.execute("EXPLAIN QUERY PLAN "+statement, arguments).fetchall():
- print r
+ plan += str(list(r)) + "\n"
+ statement = statement.replace("?", "%r") %tuple(arguments)
+ log.debug("QUERY:\n%s\nPLAN:\n%s" % (statement, plan))
        log.debug("**********************************************")

 class UnicodeCursor(sqlite3.Cursor):

But still, we can always adjust this in lp:zeitgeist itself, as it is for internal use only.

« Back to merge proposal