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

refactor(sqllab): migrate share queries via kv by permalink #29163

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

justinpark
Copy link
Member

@justinpark justinpark commented Jun 10, 2024

SUMMARY

This PR changes the existing SHARE_QUERIES_VIA_KV_STORE feature to store data using the permalink API instead of the KV store. This is one of the prerequisites of Remove old KV store endpoint and its associated asset.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

after--permalink.mov

TESTING INSTRUCTIONS

Go to SQL Lab and then click "Copy Link"

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@github-actions github-actions bot added the api Related to the REST API label Jun 10, 2024
@dosubot dosubot bot added the sqllab Namespace | Anything related to the SQL Lab label Jun 10, 2024
Copy link

codecov bot commented Jun 10, 2024

Codecov Report

Attention: Patch coverage is 91.94631% with 12 lines in your changes missing coverage. Please review.

Project coverage is 70.47%. Comparing base (76d897e) to head (26036ce).
Report is 295 commits behind head on master.

Files Patch % Lines
superset/sqllab/permalink/api.py 90.19% 5 Missing ⚠️
superset/commands/sql_lab/permalink/create.py 86.95% 3 Missing ⚠️
superset/commands/sql_lab/permalink/get.py 87.50% 3 Missing ⚠️
superset-frontend/src/SqlLab/actions/sqlLab.js 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #29163      +/-   ##
==========================================
+ Coverage   60.48%   70.47%   +9.98%     
==========================================
  Files        1931     1960      +29     
  Lines       76236    77838    +1602     
  Branches     8568     8765     +197     
==========================================
+ Hits        46114    54855    +8741     
+ Misses      28017    20823    -7194     
- Partials     2105     2160      +55     
Flag Coverage Δ
hive 49.02% <70.80%> (-0.14%) ⬇️
javascript 58.02% <91.66%> (+0.30%) ⬆️
mysql 77.28% <91.97%> (?)
postgres 77.39% <91.97%> (?)
presto 53.63% <70.80%> (-0.18%) ⬇️
python 83.75% <91.97%> (+20.26%) ⬆️
sqlite 76.84% <91.97%> (?)
unit 59.25% <70.80%> (+1.62%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@villebro
Copy link
Member

/testenv up

Copy link
Contributor

@villebro Ephemeral environment spinning up at http://52.37.81.73:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@villebro
Copy link
Member

/testenv up FEATURE_SHARE_QUERIES_VIA_KV_STORE=true

Copy link
Contributor

@villebro Ephemeral environment spinning up at http://35.86.167.107:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

Great improvement, this is long overdue! I suggest removing the SHARE_QUERIES_VIA_KV_STORE feature flag, and making the permalink only store the selected portion of the editor. Other than that this looks great!

Comment on lines 98 to +99
if (isFeatureEnabled(FeatureFlag.ShareQueriesViaKvStore)) {
return getCopyUrlForKvStore(callback);
return getCopyUrlForPermalink(callback);
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this feature be enabled by default? Now the permalink feature is only available if the SHARE_QUERIES_VIA_KV_STORE feature flag is enabled:

image

I feel we could now remove the feature flag, and make this the default behavior.

In addition, I think it would be a good idea to create the permalink based on the same query snippet that gets executed when running the query - Currently the entire editor gets persisted into the permalink, even if only a specific portion of the editor is selected.

@michael-s-molina
Copy link
Member

I suggest removing the SHARE_QUERIES_VIA_KV_STORE feature flag, and making the permalink only store the selected portion of the editor.

@villebro There's a proposal in 5.0 to remove this feature flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Related to the REST API size/XL sqllab Namespace | Anything related to the SQL Lab
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants