From 0b49ca6e5eb61e14f5ef034fea036eb8ef77036d Mon Sep 17 00:00:00 2001 From: Fabian Stanke <825364+fmos@users.noreply.github.com> Date: Thu, 2 Jun 2022 15:54:00 +0200 Subject: [PATCH] Fix the timezone format for Apache Arrow (pyarrow) As noted by @ensky in #20155 the format returned by Postgres' DATE_TRUNC is not compatible (any more?). This is a quick fix that works for me. --- superset/db_engine_specs/postgres.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/superset/db_engine_specs/postgres.py b/superset/db_engine_specs/postgres.py index c5ffc79ee7100..4b8a731d31fa4 100644 --- a/superset/db_engine_specs/postgres.py +++ b/superset/db_engine_specs/postgres.py @@ -84,14 +84,14 @@ class PostgresBaseEngineSpec(BaseEngineSpec): _time_grain_expressions = { None: "{col}", - "PT1S": "DATE_TRUNC('second', {col})", - "PT1M": "DATE_TRUNC('minute', {col})", - "PT1H": "DATE_TRUNC('hour', {col})", - "P1D": "DATE_TRUNC('day', {col})", - "P1W": "DATE_TRUNC('week', {col})", - "P1M": "DATE_TRUNC('month', {col})", - "P3M": "DATE_TRUNC('quarter', {col})", - "P1Y": "DATE_TRUNC('year', {col})", + "PT1S": "DATE_TRUNC('second', {col})||':00'", + "PT1M": "DATE_TRUNC('minute', {col})||':00'", + "PT1H": "DATE_TRUNC('hour', {col})||':00'", + "P1D": "DATE_TRUNC('day', {col})||':00'", + "P1W": "DATE_TRUNC('week', {col})||':00'", + "P1M": "DATE_TRUNC('month', {col})||':00'", + "P3M": "DATE_TRUNC('quarter', {col})||':00'", + "P1Y": "DATE_TRUNC('year', {col})||':00'", } custom_errors: Dict[Pattern[str], Tuple[str, SupersetErrorType, Dict[str, Any]]] = {