Skip to content

Commit

Permalink
Add week ending and week start to grain
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth committed Mar 21, 2016
1 parent f09f3d7 commit a9ba47f
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', "date_add('day', 5, \
date_trunc('week', date_add('day', 1, CAST({col} AS DATE))))")
Grain('week_start', "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 a9ba47f

Please sign in to comment.