changeset 6623:5b3568c99cc3

sqlalchemy: remove echo setting from .ini files and create_engine Instead of 'echo' the normal logging configration should be used. Follow the advice from https://docs.sqlalchemy.org/en/rel_1_1/core/engines.html#configuring-logging which says "when using Python logging, ensure all echo flags are set to False at all times".
author domruf <dominikruf@gmail.com>
date Tue, 09 May 2017 17:49:31 +0200
parents ff287676b206
children 80c301105d71
files development.ini kallithea/lib/db_manage.py kallithea/lib/paster_commands/setup_db.py kallithea/lib/paster_commands/template.ini.mako kallithea/tests/fixture.py kallithea/tests/test.ini
diffstat 6 files changed, 4 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/development.ini	Wed Apr 26 11:21:56 2017 +0300
+++ b/development.ini	Tue May 09 17:49:31 2017 +0200
@@ -503,7 +503,6 @@
 
 # see sqlalchemy docs for others
 
-sqlalchemy.echo = false
 sqlalchemy.pool_recycle = 3600
 
 ################################
--- a/kallithea/lib/db_manage.py	Wed Apr 26 11:21:56 2017 +0300
+++ b/kallithea/lib/db_manage.py	Tue May 09 17:49:31 2017 +0200
@@ -63,12 +63,11 @@
 
 
 class DbManage(object):
-    def __init__(self, log_sql, dbconf, root, tests=False, SESSION=None, cli_args=None):
+    def __init__(self, dbconf, root, tests=False, SESSION=None, cli_args=None):
         self.dbname = dbconf.split('/')[-1]
         self.tests = tests
         self.root = root
         self.dburi = dbconf
-        self.log_sql = log_sql
         self.db_exists = False
         self.cli_args = cli_args or {}
         self.init_db(SESSION=SESSION)
@@ -86,7 +85,7 @@
             self.sa = SESSION
         else:
             #init new sessions
-            engine = create_engine(self.dburi, echo=self.log_sql)
+            engine = create_engine(self.dburi)
             init_model(engine)
             self.sa = Session()
 
--- a/kallithea/lib/paster_commands/setup_db.py	Wed Apr 26 11:21:56 2017 +0300
+++ b/kallithea/lib/paster_commands/setup_db.py	Tue May 09 17:49:31 2017 +0200
@@ -95,7 +95,7 @@
         conf = paste.deploy.appconfig('config:' + path_to_ini_file)
 
         dbconf = conf['sqlalchemy.url']
-        dbmanage = DbManage(log_sql=True, dbconf=dbconf, root=conf['here'],
+        dbmanage = DbManage(dbconf=dbconf, root=conf['here'],
                             tests=False, cli_args=vars(opts))
         dbmanage.create_tables(override=True)
         opts = dbmanage.config_prompt(None)
--- a/kallithea/lib/paster_commands/template.ini.mako	Wed Apr 26 11:21:56 2017 +0300
+++ b/kallithea/lib/paster_commands/template.ini.mako	Tue May 09 17:49:31 2017 +0200
@@ -507,7 +507,6 @@
 %endif
 # see sqlalchemy docs for others
 
-sqlalchemy.echo = false
 sqlalchemy.pool_recycle = 3600
 
 <%text>################################</%text>
--- a/kallithea/tests/fixture.py	Wed Apr 26 11:21:56 2017 +0300
+++ b/kallithea/tests/fixture.py	Tue May 09 17:49:31 2017 +0200
@@ -329,7 +329,7 @@
         log.debug('Creating testdir %s', repos_test_path)
         os.makedirs(repos_test_path)
 
-    dbmanage = DbManage(log_sql=True, dbconf=dbconf, root=config['here'],
+    dbmanage = DbManage(dbconf=dbconf, root=config['here'],
                         tests=True)
     dbmanage.create_tables(override=True)
     # for tests dynamically set new root paths based on generated content
--- a/kallithea/tests/test.ini	Wed Apr 26 11:21:56 2017 +0300
+++ b/kallithea/tests/test.ini	Tue May 09 17:49:31 2017 +0200
@@ -506,7 +506,6 @@
 
 # see sqlalchemy docs for others
 
-sqlalchemy.echo = false
 sqlalchemy.pool_recycle = 3600
 
 ################################