Skip to content

Commit

Permalink
Merge pull request #191 from airbnb/week-grain
Browse files Browse the repository at this point in the history
Add week ending and week start to grain
  • Loading branch information
mistercrunch committed Mar 21, 2016
2 parents f09f3d7 + bad3128 commit 0890d22
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dashed/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ def grains(self):
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}'),
Expand Down

0 comments on commit 0890d22

Please sign in to comment.