Changeset - 5b3568c99cc3
[Not reviewed]
default
0 6 0
domruf - 9 years ago 2017-05-09 17:49:31
dominikruf@gmail.com
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".
6 files changed with 4 insertions and 8 deletions:
0 comments (0 inline, 0 general)
development.ini
Show inline comments
 
@@ -503,7 +503,6 @@ sqlalchemy.url = sqlite:///%(here)s/kall
 

	
 
# see sqlalchemy docs for others
 

	
 
sqlalchemy.echo = false
 
sqlalchemy.pool_recycle = 3600
 

	
 
################################
kallithea/lib/db_manage.py
Show inline comments
 
@@ -63,12 +63,11 @@ def notify(msg):
 

	
 

	
 
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 @@ class DbManage(object):
 
            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()
 

	
kallithea/lib/paster_commands/setup_db.py
Show inline comments
 
@@ -95,7 +95,7 @@ class Command(BasePasterCommand):
 
        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)
kallithea/lib/paster_commands/template.ini.mako
Show inline comments
 
@@ -507,7 +507,6 @@ sqlalchemy.url = mysql://user:pass@local
 
%endif
 
# see sqlalchemy docs for others
 

	
 
sqlalchemy.echo = false
 
sqlalchemy.pool_recycle = 3600
 

	
 
<%text>################################</%text>
kallithea/tests/fixture.py
Show inline comments
 
@@ -329,7 +329,7 @@ def create_test_env(repos_test_path, con
 
        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
kallithea/tests/test.ini
Show inline comments
 
@@ -506,7 +506,6 @@ sqlalchemy.url = sqlite:///%(here)s/kall
 

	
 
# see sqlalchemy docs for others
 

	
 
sqlalchemy.echo = false
 
sqlalchemy.pool_recycle = 3600
 

	
 
################################
0 comments (0 inline, 0 general)