mirror of https://github.com/apache/superset.git
fix(chart): non existent time grain no longer breaks the application (#23441)
Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
This commit is contained in:
parent
b0773145d6
commit
07a632891c
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue