From 402bdab5c8bd4ca9b2d3dff9a7a63d9c461ce924 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Tue, 18 Oct 2016 03:32:47 +0200 Subject: [PATCH] Add quarter time grain to postgresql (#1362) The timestamp returned is the start date of the period. Reference: https://www.postgresql.org/docs/9.1/static/functions-datetime.html --- caravel/db_engine_specs.py | 1 + 1 file changed, 1 insertion(+) diff --git a/caravel/db_engine_specs.py b/caravel/db_engine_specs.py index fa8f7e67eeb9c..1cf1b8cfa1bcc 100644 --- a/caravel/db_engine_specs.py +++ b/caravel/db_engine_specs.py @@ -56,6 +56,7 @@ class PostgresEngineSpec(BaseEngineSpec): Grain("day", _('day'), "DATE_TRUNC('day', {col})"), Grain("week", _('week'), "DATE_TRUNC('week', {col})"), Grain("month", _('month'), "DATE_TRUNC('month', {col})"), + Grain("quarter", _('quarter'), "DATE_TRUNC('quarter', {col})"), Grain("year", _('year'), "DATE_TRUNC('year', {col})"), )