You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ta...@apache.org on 2020/06/04 03:24:41 UTC

[incubator-superset] branch master updated: fix: display python_date_format in react views as well (#9934)

This is an automated email from the ASF dual-hosted git repository.

tai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new a48a2e4  fix: display python_date_format in react views as well (#9934)
a48a2e4 is described below

commit a48a2e44b52240675cf733246abb191b9912cd2c
Author: Bogdan <b....@gmail.com>
AuthorDate: Wed Jun 3 20:24:25 2020 -0700

    fix: display python_date_format in react views as well (#9934)
    
    Co-authored-by: bogdan kyryliuk <bo...@dropbox.com>
---
 superset/connectors/sqla/models.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py
index 7236eac..b413ebd 100644
--- a/superset/connectors/sqla/models.py
+++ b/superset/connectors/sqla/models.py
@@ -300,6 +300,22 @@ class TableColumn(Model, BaseColumn):
         # TODO(john-bodley): SIP-15 will explicitly require a type conversion.
         return f"""'{dttm.strftime("%Y-%m-%d %H:%M:%S.%f")}'"""
 
+    @property
+    def data(self) -> Dict[str, Any]:
+        attrs = (
+            "id",
+            "column_name",
+            "verbose_name",
+            "description",
+            "expression",
+            "filterable",
+            "groupby",
+            "is_dttm",
+            "type",
+            "python_date_format",
+        )
+        return {s: getattr(self, s) for s in attrs if hasattr(self, s)}
+
 
 class SqlMetric(Model, BaseMetric):