diff --git a/caravel/models.py b/caravel/models.py index e8973c489160..6ae1e31d50c5 100644 --- a/caravel/models.py +++ b/caravel/models.py @@ -321,8 +321,10 @@ def grains(self): 'mysql': ( Grain('Time Column', '{col}'), Grain('day', 'DATE({col})'), - Grain('week', 'DATE_SUB({col}, INTERVAL DAYOFWEEK({col}) - 1 DAY)'), - Grain('month', 'DATE_SUB({col}, INTERVAL DAYOFMONTH({col}) - 1 DAY)'), + Grain("week", "DATE(DATE_SUB({col}, " + "INTERVAL DAYOFWEEK({col}) - 1 DAY))"), + Grain("month", "DATE(DATE_SUB({col}, " + "INTERVAL DAYOFMONTH({col}) - 1 DAY))"), ), } for db_type, grains in db_time_grains.items():