Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Query.columns for bootstrap_data #20134

Merged
merged 1 commit into from
May 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -889,8 +889,11 @@ def explore(
except (SupersetException, SQLAlchemyError):
datasource_data = dummy_datasource_data

columns: List[Dict[str, Any]] = []
if datasource:
datasource_data["owners"] = datasource.owners_data
if isinstance(datasource, Query):
columns = datasource.extra.get("columns", [])

bootstrap_data = {
"can_add": slice_add_perm,
Expand All @@ -905,6 +908,7 @@ def explore(
"user": bootstrap_user_data(g.user, include_perms=True),
"forced_height": request.args.get("height"),
"common": common_bootstrap_payload(),
"columns": columns,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current columns are passed in to the datasource object. For easier lookup, do you think we can keep the same structure for queries, instead of having to look in two different places?

}
if slc:
title = slc.slice_name
Expand Down