betodealmeida commented on a change in pull request #5380: Add time grain
blacklist and addons to config.py
URL:
https://github.com/apache/incubator-superset/pull/5380#discussion_r204516159
##########
File path: superset/db_engine_specs.py
##########
@@ -65,12 +94,22 @@ class BaseEngineSpec(object):
"""Abstract class for database engine specific configurations"""
engine = 'base' # str as defined in sqlalchemy.engine.engine
- time_grains = tuple()
+ time_grain_functions = dict()
time_groupby_inline = False
limit_method = LimitMethod.FORCE_LIMIT
time_secondary_columns = False
inner_joins = True
+ @classmethod
+ def time_grains(cls):
+ blacklist = config.get('TIME_GRAIN_BLACKLIST', [])
+ grains = builtin_time_grains.copy()
+ grains.update(config.get('TIME_GRAIN_ADDONS', {}))
+ grain_functions = cls.time_grain_functions.copy()
+ grain_addon_functions = config.get('TIME_GRAIN_ADDON_FUNCTIONS', {})
+ grain_functions.update(grain_addon_functions.get(cls.engine, {}))
+ return _create_time_grains_tuple(grains, grain_functions, blacklist)
Review comment:
I think it might be better to call this `get_time_grains`, in order to be
more explicit and also because it has changed from an attribute to a method.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]