mirror of https://github.com/apache/superset.git
Add more time grains (#5083)
* Add more time grains * Use FLOOR * Fix quotes for lint
This commit is contained in:
parent
ae50845843
commit
6c3e469154
|
@ -490,6 +490,9 @@ class SqliteEngineSpec(BaseEngineSpec):
|
|||
Grain('month', _('month'),
|
||||
"DATE({col}, -strftime('%d', {col}) || ' days', '+1 day')",
|
||||
'P1M'),
|
||||
Grain('year', _('year'),
|
||||
"DATETIME(STRFTIME('%Y-01-01T00:00:00', {col}))",
|
||||
'P1Y'),
|
||||
Grain('week_ending_saturday', _('week_ending_saturday'),
|
||||
"DATE({col}, 'weekday 6')",
|
||||
'P1W/1970-01-03T00:00:00Z'),
|
||||
|
@ -1365,6 +1368,18 @@ class DruidEngineSpec(BaseEngineSpec):
|
|||
engine = 'druid'
|
||||
inner_joins = False
|
||||
|
||||
time_grains = (
|
||||
Grain('Time Column', _('Time Column'), '{col}', None),
|
||||
Grain('second', _('second'), 'FLOOR({col} TO SECOND)', 'PT1S'),
|
||||
Grain('minute', _('minute'), 'FLOOR({col} TO MINUTE)', 'PT1M'),
|
||||
Grain('hour', _('hour'), 'FLOOR({col} TO HOUR)', 'PT1H'),
|
||||
Grain('day', _('day'), 'FLOOR({col} TO DAY)', 'P1D'),
|
||||
Grain('week', _('week'), 'FLOOR({col} TO WEEK)', 'P1W'),
|
||||
Grain('month', _('month'), 'FLOOR({col} TO MONTH)', 'P1M'),
|
||||
Grain('quarter', _('quarter'), 'FLOOR({col} TO QUARTER)', 'P3M'),
|
||||
Grain('year', _('year'), 'FLOOR({col} TO YEAR)', 'P1Y'),
|
||||
)
|
||||
|
||||
|
||||
class KylinEngineSpec(BaseEngineSpec):
|
||||
"""Dialect for Apache Kylin"""
|
||||
|
|
Loading…
Reference in New Issue