You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2022/10/03 18:22:42 UTC
[superset] branch master updated: fix: Allow clickhouse dbs with timestamps to visualize queries (#21446)
This is an automated email from the ASF dual-hosted git repository.
hugh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 4d0c2ba6ef fix: Allow clickhouse dbs with timestamps to visualize queries (#21446)
4d0c2ba6ef is described below
commit 4d0c2ba6ef3f8ca7479cf46383ddac9470aa3329
Author: Hugh A. Miles II <hu...@gmail.com>
AuthorDate: Mon Oct 3 14:22:20 2022 -0400
fix: Allow clickhouse dbs with timestamps to visualize queries (#21446)
---
superset/models/helpers.py | 41 +++++++++++++++++++++++------------------
1 file changed, 23 insertions(+), 18 deletions(-)
diff --git a/superset/models/helpers.py b/superset/models/helpers.py
index c81d268a1e..da526b559c 100644
--- a/superset/models/helpers.py
+++ b/superset/models/helpers.py
@@ -1570,26 +1570,31 @@ class ExploreMixin: # pylint: disable=too-many-public-methods
groupby_all_columns[timestamp.name] = timestamp
# Use main dttm column to support index with secondary dttm columns.
- if (
- db_engine_spec.time_secondary_columns
- and self.main_dttm_col in self.dttm_cols
- and self.main_dttm_col != dttm_col.column_name
- ):
- if isinstance(self.main_dttm_col, dict):
- time_filters.append(
- self.get_time_filter(
- self.main_dttm_col,
- from_dttm,
- to_dttm,
- )
- )
+ if db_engine_spec.time_secondary_columns:
+ if isinstance(dttm_col, dict):
+ dttm_col_name = dttm_col.get("column_name")
else:
- time_filters.append(
- columns_by_name[self.main_dttm_col].get_time_filter(
- from_dttm,
- to_dttm,
+ dttm_col_name = dttm_col.column_name
+
+ if (
+ self.main_dttm_col in self.dttm_cols
+ and self.main_dttm_col != dttm_col_name
+ ):
+ if isinstance(self.main_dttm_col, dict):
+ time_filters.append(
+ self.get_time_filter(
+ self.main_dttm_col,
+ from_dttm,
+ to_dttm,
+ )
+ )
+ else:
+ time_filters.append(
+ columns_by_name[self.main_dttm_col].get_time_filter(
+ from_dttm,
+ to_dttm,
+ )
)
- )
if isinstance(dttm_col, dict):
time_filters.append(self.get_time_filter(dttm_col, from_dttm, to_dttm))