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

fix(sqllab): Add templateParams on kv store #22013

Merged

Conversation

justinpark
Copy link
Member

@justinpark justinpark commented Nov 2, 2022

SUMMARY

When "copy link" on SqlLab, it ignores the template parameters. Therefore, it's difficult to share a query with the template variables.
This commit adds the template parameters in kv store.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:

before--kv-template-params.mov

After:

after--kv-template-params.mov

TESTING INSTRUCTIONS

enable SHARE_QUERIES_VIA_KV_STORE feature
go to SqlLab and add template parameters
click "copy link" and then paste the link in the new tab
check the template parameters in new tab

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

cc: @ktmud @john-bodley

@@ -72,6 +72,7 @@ const unsavedQueryEditor = {
schema: 'query_schema_updated',
sql: 'SELECT * FROM Updated Limit 100',
autorun: true,
templateParams: '{ "my_value": "foo" }',
Copy link
Member

Choose a reason for hiding this comment

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

@justinpark how are these template parameters actually leveraged in the test? It's not apparent to me.

Copy link
Member Author

@justinpark justinpark Nov 3, 2022

Choose a reason for hiding this comment

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

@john-bodley the following block verify that this extra templateParams payload is being passed through api.
(expected includes this extra parameter)

https://github.com/apache/superset/blob/09a7d01ea763e1335de9975240e0ba97d0bd22e1/superset-frontend/src/SqlLab/components/ShareSqlLabQuery/ShareSqlLabQuery.test.tsx#L126-L130

@codecov
Copy link

codecov bot commented Nov 3, 2022

Codecov Report

Merging #22013 (cbdb55e) into master (68e8b00) will decrease coverage by 0.04%.
The diff coverage is 100.00%.

❗ Current head cbdb55e differs from pull request most recent head 4f8542b. Consider uploading reports for the commit 4f8542b to get more accurate results

@@            Coverage Diff             @@
##           master   #22013      +/-   ##
==========================================
- Coverage   67.03%   66.99%   -0.05%     
==========================================
  Files        1813     1815       +2     
  Lines       69425    69522      +97     
  Branches     7448     7479      +31     
==========================================
+ Hits        46542    46579      +37     
- Misses      20963    21013      +50     
- Partials     1920     1930      +10     
Flag Coverage Δ
javascript 53.46% <100.00%> (-0.05%) ⬇️

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

Impacted Files Coverage Δ
superset-frontend/src/SqlLab/actions/sqlLab.js 62.85% <ø> (ø)
...d/src/SqlLab/components/ShareSqlLabQuery/index.tsx 80.76% <100.00%> (ø)
superset-frontend/src/components/Select/styles.tsx 81.81% <0.00%> (-18.19%) ⬇️
superset-frontend/src/dashboard/actions/hydrate.js 1.78% <0.00%> (ø)
...ackages/superset-ui-core/src/utils/featureFlags.ts 100.00% <0.00%> (ø)
...ilters/FilterBar/FilterBarLocationSelect/index.tsx 92.85% <0.00%> (ø)
...rontend/src/components/DropdownContainer/index.tsx 0.00% <0.00%> (ø)
...set-frontend/src/components/Select/AsyncSelect.tsx 87.84% <0.00%> (+0.13%) ⬆️
superset-frontend/src/components/Select/Select.tsx 92.70% <0.00%> (+0.15%) ⬆️
...omponents/nativeFilters/FilterBar/Header/index.tsx 95.45% <0.00%> (+4.15%) ⬆️
... and 2 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@justinpark justinpark force-pushed the fix--add-template-params-on-kv-store branch from be6df1f to 09a7d01 Compare November 3, 2022 02:51
@justinpark justinpark force-pushed the fix--add-template-params-on-kv-store branch from 09a7d01 to 4f8542b Compare November 3, 2022 17:15
@justinpark
Copy link
Member Author

@eschutho can you help this review?

@justinpark
Copy link
Member Author

@eschutho we're going to merge this change next Monday if you don't have any critical issue.

Copy link
Member

@eschutho eschutho left a comment

Choose a reason for hiding this comment

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

Looks great!

@ktmud ktmud merged commit c3f1873 into apache:master Nov 14, 2022
justinpark added a commit to airbnb/superset-fork that referenced this pull request Nov 30, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/S 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants