Commit 6ee2872f authored by Gero Müller's avatar Gero Müller
Browse files

add sqlalchemy pool_size and max_overflow options

parent ea6caa93
[database]
#sqlalchemy.url = sqlite:////var/db/vispa.db
#sqlalchemy.pool_size = 5
#sqlalchemy.max_overflow = 10
[alembic]
......
......@@ -207,8 +207,22 @@ class Server(object):
def __init_database(self, **kwargs):
sa_identifier = vispa.config('database', 'sqlalchemy.url',
'sqlite:///%s/vispa.db' % self.var_dir)
pool_size = int(vispa.config('database', 'sqlalchemy.pool_size', '10'))
max_overflow = int(vispa.config(
'database',
'sqlalchemy.max_overflow',
'10'))
logger.info('Use database %s.' % sa_identifier)
self._engine = sqlalchemy.create_engine(sa_identifier, echo=False)
try:
self._engine = sqlalchemy.create_engine(
sa_identifier,
echo=False,
pool_size=pool_size,
max_overflow=max_overflow)
except TypeError:
self._engine = sqlalchemy.create_engine(
sa_identifier,
echo=False)
if vispa.config('alembic', 'use_alembic',
not sa_identifier.startswith('sqlite')):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment