These are chat archives for getredash/redash

6th
Sep 2015
Arik Fraimovich
@arikfr
Sep 06 2015 07:01
@kidambisrinivas the second time it happened, might be explained by browser cache (it won't be nginx, unless you set it up to cache responses). because query results are being sent with "infinite" cache headers. can you try running those queries in incognito mode or after clearing cache, and see if you still get the wrong results?
Sri Kidambi
@kidambisrinivas
Sep 06 2015 08:25
Yup, I cleared my cache and it worked right. Thanks a lot for your help :)
Also, is there a way to design interactive queries by taking input from user and constructing queries from it
Arik Fraimovich
@arikfr
Sep 06 2015 08:26
sure thing! thank you for reporting this. it's an edge case, but I wonder if I can prevent it
about your question:
and this dashboard: http://demo.redash.io/dashboard/ipros-demo (see the last widget there at the bottom)
it's a bit crude at the moment, and takes input only from the URL but can be used for some uses cases and will be improved in the future
Alex Wolkov
@altryne
Sep 06 2015 18:06
@arikfr hey man, started to play around with API, and looks like we have an older version, and the api_key doesn't help, I still need to be logged in
how can I enable the api in older versions? I remember vaguely that it could be possible
Arik Fraimovich
@arikfr
Sep 06 2015 18:40
@altryne what version are you running? if you're an admin, go to /admin/status.
@altryne all versions had an API, but maybe you have signature based requests enabled instead of plain api key (or the other way around)
@altryne also, newer versions have an API key per user in addition to per-query
Alex Wolkov
@altryne
Sep 06 2015 18:47
yeah I think we have the version with the signature
@arikfr because when I try to go to a query with /results.json I get the "please login" page from a scruot
not sure which version as I'm not an admin yet (waiting for olga to come back home and gimme permissions)
Arik Fraimovich
@arikfr
Sep 06 2015 18:47
if you have new enough version, you can change it to be api key based instead of signature (it's a setting)
Alex Wolkov
@altryne
Sep 06 2015 18:48
oh, great, so I'll wait for her to update it!
thanx bro
Arik Fraimovich
@arikfr
Sep 06 2015 18:48
or you can sign requests, it's not complex. I can provide Python code example
Alex Wolkov
@altryne
Sep 06 2015 18:49
yeah, that can also work
Alex Wolkov
@altryne
Sep 06 2015 19:02
oh wow :D any chance you have a ruby example (if you have to write it, don't we'll just disable the hashing from admin anyway soon)
@arikfr
Arik Fraimovich
@arikfr
Sep 06 2015 19:16
@altryne yep. someone sent me this sometime ago:
require 'json'
require 'digest/hmac'
require 'time'
require 'URI'

def sign(key, path, expires)
 return unless key

 h = Digest::HMAC.new(key, Digest::SHA1)
 h.update(path)
 h.update(expires.to_s)

 h.hexdigest 
end 

def get_query_url(redash_url, query_id, secret_api_key)
 path = "/api/queries/#{query_id}/results.json"
 expires = Time.now + 900
 expires_epoch = expires.to_i.to_f
 signature = sign(secret_api_key, path, expires_epoch) 

 full_path = "#{redash_url}#{path}?signature=#{signature}&expires=#{expires_epoch}"
end
Alex Wolkov
@altryne
Sep 06 2015 19:18
awesome! checking!