mirror of https://github.com/apache/superset.git
Merge pull request #191 from airbnb/week-grain
Add week ending and week start to grain
This commit is contained in:
commit
0890d22899
|
@ -285,6 +285,10 @@ class Database(Model, AuditMixinNullable):
|
|||
Grain('Time Column', '{col}'),
|
||||
Grain('week', "date_trunc('week', CAST({col} AS DATE))"),
|
||||
Grain('month', "date_trunc('month', CAST({col} AS DATE))"),
|
||||
Grain("week_ending_saturday", "date_add('day', 5, "
|
||||
"date_trunc('week', date_add('day', 1, CAST({col} AS DATE))))"),
|
||||
Grain("week_start_sunday", "date_add('day', -1, "
|
||||
"date_trunc('week', date_add('day', 1, CAST({col} AS DATE))))")
|
||||
),
|
||||
'mysql': (
|
||||
Grain('Time Column', '{col}'),
|
||||
|
|
Loading…
Reference in New Issue