mistercrunch closed pull request #4319: convert postgresql date_trunc() to UTC to prevent pandas error URL: https://github.com/apache/incubator-superset/pull/4319
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py index d26f633bbd..f46e91571c 100644 --- a/superset/db_engine_specs.py +++ b/superset/db_engine_specs.py @@ -285,14 +285,22 @@ class PostgresEngineSpec(BaseEngineSpec): 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})"), + Grain('second', _('second'), + "DATE_TRUNC('second', {col}) AT TIME ZONE 'UTC'"), + Grain('minute', _('minute'), + "DATE_TRUNC('minute', {col}) AT TIME ZONE 'UTC'"), + Grain('hour', _('hour'), + "DATE_TRUNC('hour', {col}) AT TIME ZONE 'UTC'"), + Grain('day', _('day'), + "DATE_TRUNC('day', {col}) AT TIME ZONE 'UTC'"), + Grain('week', _('week'), + "DATE_TRUNC('week', {col}) AT TIME ZONE 'UTC'"), + Grain('month', _('month'), + "DATE_TRUNC('month', {col}) AT TIME ZONE 'UTC'"), + Grain('quarter', _('quarter'), + "DATE_TRUNC('quarter', {col}) AT TIME ZONE 'UTC'"), + Grain('year', _('year'), + "DATE_TRUNC('year', {col}) AT TIME ZONE 'UTC'"), ) @classmethod ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services