You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "rdubois (via GitHub)" <gi...@apache.org> on 2023/03/21 10:45:24 UTC

[GitHub] [superset] rdubois opened a new issue, #23440: TIME_GRAIN_DENYLIST doesn't consider DB specific timegrains correctly

rdubois opened a new issue, #23440:
URL: https://github.com/apache/superset/issues/23440

   The `TIME_GRAIN_DENYLIST` is global to the whole Superset application, and is not specific to a given database type.
   Different database types can have a different list of time grains. For example, the Snowflake engine spec comes with a `PT5M` entry, while the SQLite one doesn't.
   
   If we want to hide the `PT5M` from the Snowflake engine, then displaying a chart for a SQLite dataset would result in breaking the application, because the `PT5M` entry doesn't exist in the SQLite dictionary, and the current implementation uses the `pop` method which fails if the key doesn't exist.
   
   #### How to reproduce the bug
   
   1. Add this configuration to your superset_config.py:
   `TIME_GRAIN_DENYLIST = ["PT5M"]`
   2. Create a new chart on top of a Mysql or Sqlite dataset
   
   ### Expected results
   
   The chart can be configured successfully, hiding the `PT5M` time grain (if it exists) in the Time section
   
   ### Actual results
   
   The application breaks with that error in the backend console:
   ```
   Traceback (most recent call last):
     File "/home/rdubois/development/sources/superset-kh/.venv201/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request
       rv = self.dispatch_request()
     File "/home/rdubois/development/sources/superset-kh/.venv201/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request
       return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
     File "/home/rdubois/development/sources/superset-kh/.venv201/lib/python3.9/site-packages/flask_appbuilder/security/decorators.py", line 133, in wraps
       return f(self, *args, **kwargs)
     File "/home/rdubois/development/sources/superset-kh/superset/utils/log.py", line 245, in wrapper
       value = f(*args, **kwargs)
     File "/home/rdubois/development/sources/superset-kh/superset/views/core.py", line 903, in explore
       datasource_data = datasource.data if datasource else dummy_datasource_data
     File "/home/rdubois/development/sources/superset-kh/superset/connectors/sqla/models.py", line 916, in data
       (g.duration, g.name) for g in self.database.grains() or []
     File "/home/rdubois/development/sources/superset-kh/superset/models/core.py", line 669, in grains
       return self.db_engine_spec.get_time_grains()
     File "/home/rdubois/development/sources/superset-kh/superset/db_engine_specs/base.py", line 451, in get_time_grains
       for duration, func in cls.get_time_grain_expressions().items():
     File "/home/rdubois/development/sources/superset-kh/superset/db_engine_specs/base.py", line 533, in get_time_grain_expressions
       time_grain_expressions.pop(key)
   KeyError: 'PT5M'
   ```
   
   #### Screenshots
   
   ![image](https://user-images.githubusercontent.com/1133383/226583376-556ced6e-f495-4478-841f-6ead23a77f71.png)
   
   
   
   ### Environment
   
   (please complete the following information):
   
   - browser type and version: Chrome 111.0.5563.65
   - superset version: 2.0.1
   - python version: 3.9
   - node.js version: 16.16.0
   - any feature flags active:
   
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [x] I have checked the superset logs for python stacktraces and included it here as text if there are any.
   - [x] I have reproduced the issue with at least the latest released version of superset.
   - [x] I have checked the issue tracker for the same issue and I haven't found one similar.
   
   ### Additional context
   
   Add any other context about the problem here.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] sfirke commented on issue #23440: TIME_GRAIN_DENYLIST doesn't consider DB specific timegrains correctly

Posted by "sfirke (via GitHub)" <gi...@apache.org>.
sfirke commented on issue #23440:
URL: https://github.com/apache/superset/issues/23440#issuecomment-1492420127

   Good call, I have a note in my config from learning this the hard way:
   > Not all grains there are present for MSSQL and excluding a non-existent grain will error, e.g., PT5S
   
   Was this closed by #23441 ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] rusackas closed issue #23440: TIME_GRAIN_DENYLIST doesn't consider DB specific timegrains correctly

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #23440: TIME_GRAIN_DENYLIST doesn't consider DB specific timegrains correctly
URL: https://github.com/apache/superset/issues/23440


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org