Skip to content

Commit

Permalink
add time granularity to redshift
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrilLeMat authored Sep 28, 2017
1 parent ef59b6b commit a110954
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions superset/db_engine_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,18 @@ def convert_dttm(cls, target_type, dttm):

class RedshiftEngineSpec(PostgresEngineSpec):
engine = 'redshift'

time_grains = (
Grain("Time Column", _('Time Column'), "{col}"),
Grain("second", _('second'), "DATE_TRUNC('second', {col})"),
Grain("minute", _('minute'), "DATE_TRUNC('minute', {col})"),
Grain("hour", _('hour'), "DATE_TRUNC('hour', {col})"),
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})"),
)


class OracleEngineSpec(PostgresEngineSpec):
Expand Down

0 comments on commit a110954

Please sign in to comment.