-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #20056 +/- ##
==========================================
- Coverage 66.74% 66.61% -0.14%
==========================================
Files 1739 1732 -7
Lines 65130 64952 -178
Branches 6898 6858 -40
==========================================
- Hits 43472 43268 -204
- Misses 19908 19928 +20
- Partials 1750 1756 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few thoughts. Did you also notice EXPLORE_CHART_DEFAULT
on line 62 which defines viz_type: 'table'
?
…nded in the back-end, it gets set to the default viz
…gain in SQL Lab Explore
@cccs-Dustin Thanks for the contribution. Many charts need to provide how to aggregate, in other words, you have to provide appropriate metric(s) or appropriate dimension. This is why datasets created from SQLLab are displayed in non-aggregated tables by default. a specific example: a dataset without a time dimension cannot generate a timeseries chart. |
I think this is OK for their use case... they want to replace the table with a different non-aggregated chart. This should allow for that use case without affecting other users/installations of Superset. If people want to set some other aggregated chart as their default, it'll be more difficult indeed, but that's not the intent of the PR here. |
/testenv up |
@rusackas Ephemeral environment spinning up at http://35.89.223.60:8080. Credentials are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work fine on the ephemeral, and LGTM!
Ephemeral environment shutdown and build artifacts deleted. |
…ig file (apache#20056) * Modified SQL Lab so it uses the default viz to explore a new dataset with * Added a comment to the config file * Remove trailing whitespace * [CLDN-1312] Removed the 'viz_type' variable so that when it is undefinded in the back-end, it gets set to the default viz * [CLDN-1312] Only sets the 'all_columns' variable if the default viz type is a 'table' * Will only pop 'selectedColumns' out of 'form_data' if it is present * [CLDN-1312] Updated files so that the default viz is now being used again in SQL Lab Explore
SUMMARY
In Superset's config file, there is a config option called
DEFAULT_VIZ_TYPE
which you can use to define which viz you would like to use in the chart explorer by default. This is a very useful config option, especially when you have a custom viz you would like to use instead of the SupersetTable
viz. However, when you are in SQL Lab and you want to create and explore a dataset, there is currently no way to to change the default viz which will be used.This PR allows for the
DEFAULT_VIZ_TYPE
config option to also be used by SQL Lab when you want to explore a dataset. This allows for consistency between the chart explorer, and exploring through SQL Lab.The changes include modifying the front-end index file so that instead of hard coding the
table
viz, it drops theviz_type
variable entirely. This way, we can set the now undefinedviz_type
to theDEFAULT_VIZ_TYPE
within the back-end. Another change that was made was passing theselectedColumns
object to the back-end, and only populating theall_columns
variable if theDEFAULT_VIZ_TYPE
is atable
.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TESTING INSTRUCTIONS
DEFAULT_VIZ_TYPE
is a different viz from the standardTable
(e.g.,pivot_table
).SELECT * FROM table_1;
).Run
button which will run the query.Explore
button to explore the result set in the data exploration view.ADDITIONAL INFORMATION