diff Database.py @ 57:254d5b89a6ca

make sqlalchemy logging configurable through the --databaseLogging commandline parameter
author Dirk Olmes <dirk@xanthippe.ping.de>
date Fri, 23 Jul 2010 04:39:08 +0200
parents 22214d79ed41
children 842727971796
line wrap: on
line diff
--- a/Database.py	Fri Jul 23 04:06:10 2010 +0200
+++ b/Database.py	Fri Jul 23 04:39:08 2010 +0200
@@ -3,6 +3,7 @@
 import sqlalchemy
 import sqlalchemy.orm
 import sys
+import util
 
 # Keep the connection to the database only once. The feed updater and the GUI app will
 # operate on a single engine/session but this comes in handy for interactive use
@@ -25,7 +26,8 @@
 def initEngine(databaseUrl):
     global engine
     if engine is None:
-        engine = sqlalchemy.create_engine(databaseUrl, echo=True)
+        verbose = util.databaseLoggingEnabled()
+        engine = sqlalchemy.create_engine(databaseUrl, echo=verbose)
 
 def initSessionMaker():
     global SessionMaker