Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY
CLDN-1254: Add Configuration to Disable SQL Lab Preview
The goal of this ticket was to add a configuration to disable the SQL Lab Preview, as the data preview tab was causing memory issues for users who were using SQL Lab with large tables of data. There was an upstream PR to create this configuration which was created in May 2021, however, it was not reviewed by any maintainers and so it 'fell between the cracks'. The author of the PR recently (2022-02-15) added a comment to the PR responding to a comment that Ville made. The author of the PR commented that he would be willing to rebase the code to work with the master branch within a few days, but he did not give a specific date by which he expected to have it completed by.
However, users have requested this feature to also be added to the cccs-1.4 branch, which is why this PR was made. The majority of the code changes were sourced from the original PR (apache#14768). Although some code changes that were not part of the original PR had to be made to make the configuration code work with the cccs-1.4 branch.
Original PR's Summary:
This PR adds a new per-database configuration option to disable data preview queries in SQL Lab. This setting is exposed in the database API as allows_preview_data. I decided to add the feature to the database API and pass the database as a parameter to addTable rather than adding a database setting into a table API response (the proposed solution in apache#14726). As a result the data preview query was moved up to addTable as well. To my eye that looks cleaner since I don't think that previewing data should be a part of "table metadata" anyway.
There is no UI change, though the UX changes when data preview is disabled to not show the data preview pane (or results) when getting table metadata.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TESTING INSTRUCTIONS
To test that the SQL Lab data preview works when the checkbox is selected
- Alternately, trigger metadata to load from the editor textbox itself.
To test that the SQL Lab data preview is disabled when the checkbox is not selected
- Alternately, trigger metadata to load from the editor textbox itself.
You can also run the following tests to make sure they still pass after the code modifications:
npm test ./src/components/DatabaseSelector/DatabaseSelector.test.tsx
npm test ./src/SqlLab/actions/sqlLab.test.js
npm test ./src/SqlLab/components/SqlEditor/SqlEditor.test.jsx
npm test ./src/SqlLab/components/SqlEditorLeftBar/SqlEditorLeftBar.test.jsx
tox -e py38 -- tests/integration_tests/core_tests.py
[fails 8 tests in both my this branch and the cccs-1.4 branch]tox -e py38 -- tests/integration_tests/databases/api_tests.py
[fails 5 tests in both this branch and the cccs-1.4 branch]ADDITIONAL INFORMATION