[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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 5 deletions

View File

@ -34,10 +34,16 @@ config = context.config
fileConfig(config.config_file_name)
logger = logging.getLogger("alembic.env")
config.set_main_option("sqlalchemy.url", current_app.config["SQLALCHEMY_DATABASE_URI"])
DATABASE_URI = current_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."
)
config.set_main_option("sqlalchemy.url", DATABASE_URI)
target_metadata = Base.metadata # pylint: disable=no-member
# other values from the config, defined by the needs of env.py,
# can be acquired:
# my_important_option = config.get_main_option("my_important_option")

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()

View File

@ -30,6 +30,12 @@ SUPERSET_WEBSERVER_PORT = 8081
if "SUPERSET__SQLALCHEMY_DATABASE_URI" in os.environ:
SQLALCHEMY_DATABASE_URI = os.environ["SUPERSET__SQLALCHEMY_DATABASE_URI"]
if "sqlite" in SQLALCHEMY_DATABASE_URI:
logger.warning(
"SQLite Database support for metadata databases will be \
removed in a future version of Superset."
)
SQL_MAX_ROW = 666
SQLLAB_CTAS_NO_LIMIT = True # SQL_MAX_ROW will not take affect for the CTA queries
FEATURE_FLAGS = {"foo": "bar", "KV_STORE": True, "SHARE_QUERIES_VIA_KV_STORE": True}

View File

@ -32,6 +32,12 @@ SUPERSET_WEBSERVER_PORT = 8081
if "SUPERSET__SQLALCHEMY_DATABASE_URI" in os.environ:
SQLALCHEMY_DATABASE_URI = os.environ["SUPERSET__SQLALCHEMY_DATABASE_URI"]
if "sqlite" in SQLALCHEMY_DATABASE_URI:
logger.warning(
"SQLite Database support for metadata databases will be removed \
in a future version of Superset."
)
SQL_SELECT_AS_CTA = True
SQL_MAX_ROW = 666