You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2018/05/29 19:43:50 UTC
[incubator-superset] branch master updated: Add more time grains
(#5083)
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new 6c3e469 Add more time grains (#5083)
6c3e469 is described below
commit 6c3e469154684d249020b44f99735fb032518312
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Tue May 29 12:43:48 2018 -0700
Add more time grains (#5083)
* Add more time grains
* Use FLOOR
* Fix quotes for lint
---
superset/db_engine_specs.py | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py
index 03cf2bd..c732d9b 100644
--- a/superset/db_engine_specs.py
+++ b/superset/db_engine_specs.py
@@ -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"""
--
To stop receiving notification emails like this one, please contact
maximebeauchemin@apache.org.