mirror of
https://github.com/apache/superset.git
synced 2026-04-16 06:34:52 +00:00
Merge pull request #191 from airbnb/week-grain
Add week ending and week start to grain
This commit is contained in:
@@ -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}'),
|
||||
|
||||
Reference in New Issue
Block a user