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

Case insensitive parameters in Redash query result cache #2137

Closed
albrycht opened this issue Dec 7, 2017 · 4 comments · Fixed by #4254
Closed

Case insensitive parameters in Redash query result cache #2137

albrycht opened this issue Dec 7, 2017 · 4 comments · Fixed by #4254

Comments

@albrycht
Copy link

albrycht commented Dec 7, 2017

Issue Summary

Redash may display wrong results for query with case sensitive parameter. It looks like results cache is ignoring param letters size.

Steps to Reproduce

  1. Create a query with global text parameter.
  2. Create dashboard with visualization for this query.
  3. Open dashboard with parameter set to lowercase letter for example 'test'
  4. Open dashboard on a new tab with parameter 'TEST'.

In the last step you should receive visualization for parameter 'test' even when parameter value is set to 'TEST'

I have been able to reproduce this scenario on demo.redash.io. To reproduce do:

  1. Open link: http://demo.redash.io/dashboard/ma_dashboard?p_dashboard_name=test
    You should see rows from dashboard table with name test
  2. Open link: http://demo.redash.io/dashboard/ma_dashboard?p_dashboard_name=Test
    You should see rows from dashboard table with name test even when parameter dashboard_name is set to Test. After refreshing visualization result changed to proper one.

Technical details:

  • Redash Version: 3.0.0+b3134
  • Browser/OS: Chrome/Firefox/Opera
  • How did you install Redash: used demo.redash.io
@albrycht albrycht changed the title Cese sensitive parameters in Redash query result cache Cese insensitive parameters in Redash query result cache Dec 7, 2017
@arikfr arikfr added this to the v4 milestone Dec 11, 2017
@arikfr
Copy link
Member

arikfr commented Dec 11, 2017

The problem is in the redash.utils.gen_query_hash method. And it's actually documented there as a TODO item 😳

I think we can stop lower casing the query in this method. We don't need to dedup that aggressively.

@ClaudioDavi
Copy link

ClaudioDavi commented Dec 12, 2017

Hi, I've looked around at the code, reproduced the error and I think this can be my first PR.
@arikfr your suggestion is to remove the .lower() when we're creating the hash?

@arikfr
Copy link
Member

arikfr commented Dec 13, 2017

@ClaudioDavi yes, but also need a migration to recalculate the query hash for all existing queries.

@ClaudioDavi
Copy link

Ok, thanks @arikfr ! Do you have any migration examples for me to have a look and follow through?

@jezdez jezdez changed the title Cese insensitive parameters in Redash query result cache Case insensitive parameters in Redash query result cache Oct 18, 2019
@arikfr arikfr mentioned this issue Dec 1, 2019
6 tasks
osule added a commit to osule/redash that referenced this issue Jul 16, 2023
Generating the query hash from the query text with no lowercasing of the query text
allows case-sensitive parameter values in the dashboard to have different cache entries.

Fixes getredash#2137
justinclift pushed a commit that referenced this issue Jul 17, 2023
Generating the query hash from the query text with no lowercasing of the query text
allows case-sensitive parameter values in the dashboard to have different cache entries.

Fixes #2137
EmilaineBorato pushed a commit to sondautilities/sonda_d4b_redash that referenced this issue Jul 24, 2023
Generating the query hash from the query text with no lowercasing of the query text
allows case-sensitive parameter values in the dashboard to have different cache entries.

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

Successfully merging a pull request may close this issue.

3 participants