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

RedisCache lost support for function as a key_prefix #27077

Open
3 tasks done
dbascoules opened this issue Feb 11, 2024 · 2 comments
Open
3 tasks done

RedisCache lost support for function as a key_prefix #27077

dbascoules opened this issue Feb 11, 2024 · 2 comments

Comments

@dbascoules
Copy link

Bug description

The hability to specify a function as a key_prefix for RedisCache doesn't work anymore in Superset.
Expected type 'str', got '() -> str' instead error is thrown.

This was fundamental for my usecase where I use the subdomain of the Superset URL as an ingredient of my PostgreSQL RLS.
Each subdomain correspond to a subset of the data that users may query through Superset (only one instance).

Introducing the notion of subdomain in the Redis cache key prefix avoids a cache mismatch between subdomains and data subsets.
It's implemented with a function parametrized in RedisCache key_prefix.

I submitted a PR in the concerned lib project : pallets-eco/cachelib#332.

How to reproduce the bug

  1. Create a simple function returning a string.
  2. Parameter this function in the RedisCache key_prefix.
  3. Display in Superset anything related to your data that will be cached to throw the error.

Screenshots/recordings

No response

Superset version

3.0.3

Python version

3.11

Node version

Not applicable

Browser

Not applicable

Additional context

`Expected type 'str', got '() -> str'

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
@michael-s-molina
Copy link
Member

Hi @dbascoules. In order to upgrade Superset's cachelib dependency to 0.12.0, which contains the support for callable keys, we need flask-caching to also update their requirements to allow that version.

@rusackas
Copy link
Member

rusackas commented Jul 9, 2024

Is this still an issue, and if it is, is it a Superset issue? I would be tempted to close this as stale, but thought I should seek opinions here first. Mabye it's worth filing an issue on flask-caching if they haven't published a new release since this issue was opened nearly 5 months ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants