dangdtr commented on code in PR #42474:
URL: https://github.com/apache/superset/pull/42474#discussion_r3657166484
##########
superset/connectors/sqla/models.py:
##########
@@ -526,28 +560,11 @@ def data_for_slices( # pylint: disable=too-many-locals
# noqa: C901
if "column" in filter_config
)
- # for legacy dashboard imports which have the wrong query_context
in them
- try:
- query_context = slc.get_query_context()
- except (DatasetNotFoundError, DatasourceNotFound):
- logger.warning(
- "Failed to load query_context for chart '%s' (id=%s): "
- "referenced datasource not found",
- slc.slice_name,
- slc.id,
- )
- query_context = None
-
- # legacy charts don't have query_context charts
- if query_context:
- column_names.update(
- [
- utils.get_column_name(column_)
- for query in query_context.queries
- for column_ in query.columns
- ]
- or []
- )
+ query_context_column_names = self._extract_query_context_columns(
+ slc.query_context
+ )
+ if query_context_column_names is not None:
+ column_names.update(query_context_column_names)
else:
_columns = [
Review Comment:
Fixed in 57b1e99cee1f39e9bf5119c1927e4df4f75dafd8. Empty query lists and
query contexts containing only invalid entries now return None, so
data_for_slices falls back to form_data. Added regression coverage for both
cases.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]