diff options
author | Artem Tarasov | 2015-05-20 17:43:15 +0300 |
---|---|---|
committer | Artem Tarasov | 2015-05-20 17:43:15 +0300 |
commit | cfb2fe19ca952e368999eec8b8582f99edd86dc7 (patch) | |
tree | ed991a0ba536a9a067e1a9adf271cd29ac693424 /wqflask | |
parent | 56174cf30ec604318c37c659ad4fca180a90deb6 (diff) | |
download | genenetwork2-cfb2fe19ca952e368999eec8b8582f99edd86dc7.tar.gz |
revert database.py setup
Diffstat (limited to 'wqflask')
-rwxr-xr-x | wqflask/wqflask/database.py | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/wqflask/wqflask/database.py b/wqflask/wqflask/database.py index 110b82d2..159c5d6c 100755 --- a/wqflask/wqflask/database.py +++ b/wqflask/wqflask/database.py @@ -13,27 +13,10 @@ db_session = scoped_session(sessionmaker(autocommit=False, Base = declarative_base() Base.query = db_session.query_property() -from sqlalchemy import event -from sqlalchemy.engine import Engine -import logging -import time +#import logging # -logging.basicConfig() -logger = logging.getLogger('sqlalchemy.engine') -logger.setLevel(logging.INFO) - -@event.listens_for(Engine, "before_cursor_execute") -def before_cursor_execute(conn, cursor, statement, - parameters, context, executemany): - conn.info.setdefault('query_start_time', []).append(time.time()) - logger.info("Start Query: %s", statement) - -@event.listens_for(Engine, "after_cursor_execute") -def after_cursor_execute(conn, cursor, statement, - parameters, context, executemany): - total = time.time() - conn.info['query_start_time'].pop(-1) - logger.info("Query Complete!") - logger.info("Total Time: %f", total) +#logging.basicConfig() +#logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO) def init_db(): # import all modules here that might define models so that |