You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by cr...@apache.org on 2020/04/28 21:28:24 UTC

[incubator-superset] branch master updated: [logging] deprecation notices for SQLite (#9662)

This is an automated email from the ASF dual-hosted git repository.

craigrueda pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new b27a81e  [logging] deprecation notices for SQLite (#9662)
b27a81e is described below

commit b27a81e0da2267d4774166d7aacf4657dea90425
Author: Lily Kuang <li...@preset.io>
AuthorDate: Tue Apr 28 14:28:09 2020 -0700

    [logging] deprecation notices for SQLite (#9662)
    
    * [logging] deprecation notices for SQLite
    
    * [logging] use warning for SQLite notice
    
    * [logging] update grammar
---
 superset/migrations/env.py               | 10 ++++++++--
 superset/sql_lab.py                      | 10 +++++++---
 tests/superset_test_config.py            |  6 ++++++
 tests/superset_test_config_thumbnails.py |  6 ++++++
 4 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/superset/migrations/env.py b/superset/migrations/env.py
index 37b0190..923516e 100755
--- a/superset/migrations/env.py
+++ b/superset/migrations/env.py
@@ -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")
diff --git a/superset/sql_lab.py b/superset/sql_lab.py
index 65d61f4..ab952db 100644
--- a/superset/sql_lab.py
+++ b/superset/sql_lab.py
@@ -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()
diff --git a/tests/superset_test_config.py b/tests/superset_test_config.py
index 0b8bff7..888f27b 100644
--- a/tests/superset_test_config.py
+++ b/tests/superset_test_config.py
@@ -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}
diff --git a/tests/superset_test_config_thumbnails.py b/tests/superset_test_config_thumbnails.py
index bf68df5..5a88a04 100644
--- a/tests/superset_test_config_thumbnails.py
+++ b/tests/superset_test_config_thumbnails.py
@@ -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