You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2023/03/23 14:37:13 UTC

[superset] branch master updated: fix(chart): non existent time grain no longer breaks the application (#23441)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 07a632891c fix(chart): non existent time grain no longer breaks the application (#23441)
07a632891c is described below

commit 07a632891c1c8feb5f0ac3104a5c852d1b86ae87
Author: Rémy DUBOIS <rd...@gmail.com>
AuthorDate: Thu Mar 23 15:36:50 2023 +0100

    fix(chart): non existent time grain no longer breaks the application (#23441)
    
    Co-authored-by: Ville Brofeldt <33...@users.noreply.github.com>
---
 superset/db_engine_specs/base.py                                  | 2 +-
 tests/integration_tests/db_engine_specs/base_engine_spec_tests.py | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/superset/db_engine_specs/base.py b/superset/db_engine_specs/base.py
index f1a46ceb34..fb76d9363d 100644
--- a/superset/db_engine_specs/base.py
+++ b/superset/db_engine_specs/base.py
@@ -704,7 +704,7 @@ class BaseEngineSpec:  # pylint: disable=too-many-public-methods
         time_grain_expressions.update(grain_addon_expressions.get(cls.engine, {}))
         denylist: List[str] = current_app.config["TIME_GRAIN_DENYLIST"]
         for key in denylist:
-            time_grain_expressions.pop(key)
+            time_grain_expressions.pop(key, None)
 
         return dict(
             sorted(
diff --git a/tests/integration_tests/db_engine_specs/base_engine_spec_tests.py b/tests/integration_tests/db_engine_specs/base_engine_spec_tests.py
index 87de98db1c..6048ac8f19 100644
--- a/tests/integration_tests/db_engine_specs/base_engine_spec_tests.py
+++ b/tests/integration_tests/db_engine_specs/base_engine_spec_tests.py
@@ -332,11 +332,12 @@ def test_is_readonly():
 
 def test_time_grain_denylist():
     config = app.config.copy()
-    app.config["TIME_GRAIN_DENYLIST"] = ["PT1M"]
+    app.config["TIME_GRAIN_DENYLIST"] = ["PT1M", "SQLITE_NONEXISTENT_GRAIN"]
 
     with app.app_context():
         time_grain_functions = SqliteEngineSpec.get_time_grain_expressions()
         assert not "PT1M" in time_grain_functions
+        assert not "SQLITE_NONEXISTENT_GRAIN" in time_grain_functions
 
     app.config = config