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

Feature/cldn 1254 #92

Merged
merged 4 commits into from
Feb 18, 2022
Merged

Feature/cldn 1254 #92

merged 4 commits into from
Feb 18, 2022

Conversation

cccs-Dustin
Copy link
Member

@cccs-Dustin cccs-Dustin commented Feb 16, 2022

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

  1. In the database configuration settings, select "Allow SQL Lab data preview queries" under "Advanced>SQL Lab".
  2. In SQL Editor, select the database you have configured, and then any schema or table.
    - Alternately, trigger metadata to load from the editor textbox itself.
  3. Table metadata should load as normal, and a data preview query should run.

To test that the SQL Lab data preview is disabled when the checkbox is not selected

  1. In the database configuration settings, unselect "Allow SQL Lab data preview queries" under "Advanced>SQL Lab".
  2. In SQL Editor, select the database you have configured, and then any schema or table.
    - Alternately, trigger metadata to load from the editor textbox itself.
  3. Table metadata should load as normal, but no data preview query should run.

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

@cccs-Dustin cccs-Dustin added the enhancement New feature or request label Feb 16, 2022
@cccs-Dustin cccs-Dustin merged commit 7f79358 into cccs-1.4 Feb 18, 2022
@cccs-Dustin cccs-Dustin deleted the feature/CLDN-1254 branch February 18, 2022 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants