Mercurial > public > src > rhodecode
comparison pylons_app/lib/timerproxy.py @ 49:3ada2f409c1c
Added sqlalchemy support
made models for database
changed views to handle sqlalchemy
author | Marcin Kuzminski <marcin@python-blog.com> |
---|---|
date | Thu, 08 Apr 2010 01:50:46 +0200 |
parents | |
children | 0c22a870bb79 |
comparison
equal
deleted
inserted
replaced
48:8e250e86a670 | 49:3ada2f409c1c |
---|---|
1 from sqlalchemy.interfaces import ConnectionProxy | |
2 import time | |
3 import logging | |
4 log = logging.getLogger(__name__) | |
5 | |
6 class TimerProxy(ConnectionProxy): | |
7 def cursor_execute(self, execute, cursor, statement, parameters, context, executemany): | |
8 now = time.time() | |
9 try: | |
10 log.info(">>>>> STARTING QUERY >>>>>") | |
11 return execute(cursor, statement, parameters, context) | |
12 finally: | |
13 total = time.time() - now | |
14 log.info("Query: %s" % statement % parameters) | |
15 log.info("<<<<< TOTAL TIME: %f <<<<<" % total) |