Make session acquisition silent by default
Also suppress notification to stdout of database in use.
This commit is contained in:
parent
3f609f6f2f
commit
44e4e451ad
@ -46,7 +46,7 @@ elif MM_ENV == 'DEVELOPMENT':
|
||||
else:
|
||||
raise ValueError(f"Unknown MusicMuster environment: {MM_ENV=}")
|
||||
|
||||
DEBUG(f"Using {dbname} database", True)
|
||||
DEBUG(f"Using {dbname} database")
|
||||
MYSQL_CONNECT = f"mysql+mysqldb://{dbuser}:{dbpw}@{dbhost}/{dbname}"
|
||||
|
||||
engine = sqlalchemy.create_engine(
|
||||
@ -64,9 +64,8 @@ def Session():
|
||||
function = frame.function
|
||||
lineno = frame.lineno
|
||||
Session = scoped_session(sessionmaker(bind=engine))
|
||||
DEBUG(f"Session acquired, {file=}, {function=}, {lineno=}, {Session=}",
|
||||
True)
|
||||
DEBUG(f"Session acquired, {file=}, {function=}, {lineno=}, {Session=}")
|
||||
yield Session
|
||||
DEBUG(" Session released", True)
|
||||
DEBUG(" Session released")
|
||||
Session.commit()
|
||||
Session.close()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user