mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Suppress SQLAlchemy warnings for DELETE statements in Database.py
This commit is contained in:
parent
444961ec99
commit
c6d5061cd4
1 changed files with 5 additions and 0 deletions
|
|
@ -18,6 +18,7 @@ from threading import Lock
|
|||
from typing import Any, Dict, List, Literal, Optional, Set, Tuple, Union
|
||||
from time import sleep
|
||||
from uuid import uuid4
|
||||
from warnings import filterwarnings
|
||||
|
||||
from model import (
|
||||
Base,
|
||||
|
|
@ -56,6 +57,7 @@ from sqlalchemy.exc import (
|
|||
IntegrityError,
|
||||
OperationalError,
|
||||
ProgrammingError,
|
||||
SAWarning,
|
||||
SQLAlchemyError,
|
||||
)
|
||||
from sqlalchemy.orm import scoped_session, sessionmaker
|
||||
|
|
@ -75,6 +77,9 @@ def set_sqlite_pragma(dbapi_connection, _):
|
|||
cursor.close()
|
||||
|
||||
|
||||
filterwarnings("ignore", category=SAWarning, message="DELETE statement on table .* expected to delete")
|
||||
|
||||
|
||||
class Database:
|
||||
DB_STRING_RX = re_compile(r"^(?P<database>(mariadb|mysql)(\+pymysql)?|sqlite(\+pysqlite)?|postgresql(\+psycopg)?):/+(?P<path>/[^\s]+)")
|
||||
READONLY_ERROR = ("readonly", "read-only", "command denied", "Access denied")
|
||||
|
|
|
|||
Loading…
Reference in a new issue