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(SQL Lab): Make SQL Lab explore use the default viz from the config file #20056

Merged
merged 9 commits into from
Jun 22, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ export default class ResultSet extends React.PureComponent<
metrics: [],
groupby: [],
time_range: 'No filter',
viz_type: 'table',
viz_type: '',
rusackas marked this conversation as resolved.
Show resolved Hide resolved
all_columns: selectedColumns.map(c => c.name),
cccs-Dustin marked this conversation as resolved.
Show resolved Hide resolved
row_limit: 1000,
});
Expand Down
2 changes: 1 addition & 1 deletion superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def _try_json_readsha(filepath: str, length: int) -> Optional[str]:
# can be replaced at build time to expose build information.
BUILD_NUMBER = None

# default viz used in chart explorer
# default viz used in chart explorer & SQL Lab explore
DEFAULT_VIZ_TYPE = "table"

# default row limit when requesting chart data
Expand Down
3 changes: 3 additions & 0 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,9 @@ def explore(
if not viz_type and datasource and datasource.default_endpoint:
return redirect(datasource.default_endpoint)

if form_data.get("viz_type") == "":
form_data["viz_type"] = app.config["DEFAULT_VIZ_TYPE"]

# slc perms
slice_add_perm = security_manager.can_access("can_write", "Chart")
slice_overwrite_perm = is_owner(slc, g.user) if slc else False
Expand Down