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

feat: add new cache_query_by_user key #23415

Merged
merged 3 commits into from
Mar 20, 2023

Conversation

eschutho
Copy link
Member

SUMMARY

We'd like to use this feature from #20114 for the use case where someone doesn't have user impersonation on for the database, but still wants to create different cache keys in Superset for each user. I believe that some users prefer to use their database for RLS, but this will enable them to use the Superset RLS instead.

I thought about adapting with the existing key, but I didn't want to change any functionality, so instead I created a new key CACHE_QUERY_BY_USER

TESTING INSTRUCTIONS

With the CACHE_QUERY_BY_USER flag on, run a query with two different users, with different superset rls permissions and you should get different cached results.

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

@eschutho eschutho force-pushed the elizabeth/cache-impersonation branch from fb317f4 to e83961f Compare March 17, 2023 22:20
@codecov
Copy link

codecov bot commented Mar 17, 2023

Codecov Report

Merging #23415 (4a8c256) into master (42e8d1b) will increase coverage by 1.65%.
The diff coverage is 100.00%.

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

@@            Coverage Diff             @@
##           master   #23415      +/-   ##
==========================================
+ Coverage   65.96%   67.61%   +1.65%     
==========================================
  Files        1907     1907              
  Lines       73590    73594       +4     
  Branches     7982     7982              
==========================================
+ Hits        48546    49763    +1217     
+ Misses      22996    21783    -1213     
  Partials     2048     2048              
Flag Coverage Δ
hive 52.74% <37.50%> (-0.01%) ⬇️
mysql 78.40% <37.50%> (-0.01%) ⬇️
postgres 78.49% <37.50%> (-0.01%) ⬇️
presto 52.67% <37.50%> (-0.01%) ⬇️
python 82.33% <100.00%> (+3.41%) ⬆️
sqlite 76.96% <37.50%> (?)
unit 52.58% <100.00%> (?)

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

Impacted Files Coverage Δ
superset/config.py 91.78% <ø> (ø)
superset/common/query_object.py 95.97% <100.00%> (+1.62%) ⬆️

... and 89 files with indirect coverage changes

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

Copy link
Member

@betodealmeida betodealmeida 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! I left a few small nits, but this is good to go.

tests/unit_tests/queries/query_object_test.py Outdated Show resolved Hide resolved
tests/unit_tests/queries/query_object_test.py Outdated Show resolved Hide resolved
eschutho and others added 2 commits March 17, 2023 16:02
Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>
Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>
@eschutho eschutho merged commit b021f6e into apache:master Mar 20, 2023
@eschutho eschutho deleted the elizabeth/cache-impersonation branch March 20, 2023 19:17
jinghua-qa pushed a commit to preset-io/superset that referenced this pull request Mar 20, 2023
Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>
(cherry picked from commit b021f6e)
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.0.0 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 preset:2023.11 size/L 🚢 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants