Skip to content

Commit

Permalink
Add yearly and quarterly granularities to mysql engine backend (#1518)
Browse files Browse the repository at this point in the history
  • Loading branch information
plumbeo authored and mistercrunch committed Nov 2, 2016
1 parent a13bed2 commit cdf4dd0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions caravel/db_engine_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ class MySQLEngineSpec(BaseEngineSpec):
"INTERVAL DAYOFWEEK({col}) - 1 DAY))"),
Grain("month", _('month'), "DATE(DATE_SUB({col}, "
"INTERVAL DAYOFMONTH({col}) - 1 DAY))"),
Grain("quarter", _('quarter'), "MAKEDATE(YEAR({col}), 1) "
"+ INTERVAL QUARTER({col}) QUARTER - INTERVAL 1 QUARTER"),
Grain("year", _('year'), "DATE(DATE_SUB({col}, "
"INTERVAL DAYOFYEAR({col}) - 1 DAY))"),
)

@classmethod
Expand Down

0 comments on commit cdf4dd0

Please sign in to comment.