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:
|
else:
|
||||||
raise ValueError(f"Unknown MusicMuster environment: {MM_ENV=}")
|
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}"
|
MYSQL_CONNECT = f"mysql+mysqldb://{dbuser}:{dbpw}@{dbhost}/{dbname}"
|
||||||
|
|
||||||
engine = sqlalchemy.create_engine(
|
engine = sqlalchemy.create_engine(
|
||||||
@ -64,9 +64,8 @@ def Session():
|
|||||||
function = frame.function
|
function = frame.function
|
||||||
lineno = frame.lineno
|
lineno = frame.lineno
|
||||||
Session = scoped_session(sessionmaker(bind=engine))
|
Session = scoped_session(sessionmaker(bind=engine))
|
||||||
DEBUG(f"Session acquired, {file=}, {function=}, {lineno=}, {Session=}",
|
DEBUG(f"Session acquired, {file=}, {function=}, {lineno=}, {Session=}")
|
||||||
True)
|
|
||||||
yield Session
|
yield Session
|
||||||
DEBUG(" Session released", True)
|
DEBUG(" Session released")
|
||||||
Session.commit()
|
Session.commit()
|
||||||
Session.close()
|
Session.close()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user