Skip to content

Commit

Permalink
set pool size and max overflow (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
lionick authored Oct 19, 2023
1 parent 815a684 commit f4d34c6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
def get_session():
# Initialize
config_file = 'config.global.py'
db_params = configParser.getConfig('database_parameters', config_file)

url = configParser.getConfig('database_parameters', config_file)['database_url']
engine = create_engine(url)
url = db_params['database_url']
pool_size = int(db_params.get('pool_size', 25))
max_overflow = int(db_params.get('max_overflow', 5))
engine = create_engine(url, pool_size=pool_size, max_overflow=max_overflow)

with Session(engine) as session:
yield session

0 comments on commit f4d34c6

Please sign in to comment.