[logging] deprecation notices for SQLite (#9662)

* [logging] deprecation notices for SQLite

* [logging] use warning for SQLite notice

* [logging] update grammar
This commit is contained in:
Lily Kuang
2020-04-28 14:28:09 -07:00
committed by GitHub
parent 13aa889796
commit b27a81e0da
4 changed files with 27 additions and 5 deletions

View File

@@ -121,10 +121,14 @@ def get_query(query_id, session):
@contextmanager
def session_scope(nullpool):
"""Provide a transactional scope around a series of operations."""
if nullpool:
engine = sqlalchemy.create_engine(
app.config["SQLALCHEMY_DATABASE_URI"], poolclass=NullPool
database_uri = app.config["SQLALCHEMY_DATABASE_URI"]
if "sqlite" in database_uri:
logger.warning(
"SQLite Database support for metadata databases will be removed \
in a future version of Superset."
)
if nullpool:
engine = sqlalchemy.create_engine(database_uri, poolclass=NullPool)
session_class = sessionmaker()
session_class.configure(bind=engine)
session = session_class()