You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/02/11 10:24:35 UTC

[GitHub] [superset] ktmud commented on a change in pull request #10637: feat(viz-plugins): add date formatting to pivot-table

ktmud commented on a change in pull request #10637:
URL: https://github.com/apache/superset/pull/10637#discussion_r574388781



##########
File path: superset/viz.py
##########
@@ -840,8 +841,20 @@ def get_data(self, df: pd.DataFrame) -> VizData:
         for metric in metrics:
             aggfuncs[metric] = self.get_aggfunc(metric, df, self.form_data)
 
-        groupby = self.form_data.get("groupby")
-        columns = self.form_data.get("columns")
+        groupby = self.form_data.get("groupby") or []
+        columns = self.form_data.get("columns") or []
+
+        def _format_datetime(value: Any) -> Optional[str]:
+            if isinstance(value, str):
+                return f"__timestamp:{datetime_to_epoch(pd.Timestamp(value))}"

Review comment:
       @villebro it seems this only supports unix timestamp data type, not `datetime`. E.g. column generated from `SELECT now()` or `SELECT date_trunc(TIMESTAMP '2020-01-01 00:00:00')` in PostgreSQL.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org