trying something that I *think* should be throwing warnings for sql 2.0 issues, not sure it works?

This commit is contained in:
2023-09-27 14:29:03 +10:00
parent f34a8b23e0
commit 799689d26e

22
main.py
View File

@@ -18,6 +18,28 @@ from flask_ldap3_login import LDAP3LoginManager
from flask_login import LoginManager, login_user, login_required, UserMixin, current_user, logout_user
from flask_ldap3_login.forms import LDAPLoginForm
# DEAL WITH MIGRATION TO SQLALCHEMY 2.0
import warnings
from sqlalchemy import exc
# for warnings not included in regex-based filter below, just log
warnings.filterwarnings("always", category=exc.Base20DeprecationWarning)
# for warnings related to execute() / scalar(), raise
for msg in [
r"The (?:Executable|Engine)\.(?:execute|scalar)\(\) function",
r"The current statement is being autocommitted using implicit autocommit,",
r"The connection.execute\(\) method in SQLAlchemy 2.0 will accept "
"parameters as a single dictionary or a single sequence of "
"dictionaries only.",
r"The Connection.connect\(\) function/method is considered legacy",
r".*DefaultGenerator.execute\(\)",
]:
warnings.filterwarnings(
"error",
message=msg,
category=exc.Base20DeprecationWarning,
)
# pylint: disable=no-member