These are chat archives for getredash/redash

15th
May 2015
sunand chakradhar
@sunandchakradhar
May 15 2015 11:15
hi arikfr
wondering why you are storing last_query_results_id in queries table instead of mapping the other way round, having query_id in query_results table
arent all the previous query_results rows left orphaned
Arik Fraimovich
@arikfr
May 15 2015 11:19
Because one query result might belong to multiple queries.
sunand chakradhar
@sunandchakradhar
May 15 2015 11:20
multiple queries?
Arik Fraimovich
@arikfr
May 15 2015 11:22
It's not common but for various reasons, it's possible that multiple query objects will in fact be the same query.
sunand chakradhar
@sunandchakradhar
May 15 2015 11:26
there is no way we can map query results to queries right?
may be with query hash?
Arik Fraimovich
@arikfr
May 15 2015 11:27
That's how I do it (with query hash).
Also it's wrong to associate query result with query object because the actual query might change and no longer reference this query result.
What are you trying to do?
sunand chakradhar
@sunandchakradhar
May 15 2015 11:31
i was running queries with variables and trying to retrieve last query result per variable. May be i have to fetch using query hash itself
Arik Fraimovich
@arikfr
May 15 2015 11:35
You can pass to the query result api endpoint the resulting query with the variable and it will do it for you (do the matching based on query hash). Note that queries with variables generate another query hash once the variable used.
I'm typing from my phone so can't get into much details, but let me know if you need some help, I'll try to provide more details late when near the computer.
sunand chakradhar
@sunandchakradhar
May 15 2015 11:39
no problem, Thank you
one final question. I am not very familiar with flask. is there already api to retrieve the query result based on its hash?
Arik Fraimovich
@arikfr
May 15 2015 11:41
Yes.
One minute
Sorry, it's not based on hash but rather on query text, the server calculates the hash.
I will be happy to understand what you're trying to do as I want to know how people use the variables feature.
You can also write me in private (here or by email)
sunand chakradhar
@sunandchakradhar
May 15 2015 12:41
my ideal requirement is to have and api like https://redash.packetzoom.net/api/queries/1/results.json?p_action={value}
sunand chakradhar
@sunandchakradhar
May 15 2015 12:47
now i understood that i can do the same using query_results api itself by sending the query again
Arik Fraimovich
@arikfr
May 15 2015 13:14
It's what the UI does (send the query agsin).
Re. The more sensible option (send only variable), see discussion here :EverythingMe/redash#285
Your other issue will be Authentication, because api keys are "attached" to queies. Giving users api keys is planned...
sunand chakradhar
@sunandchakradhar
May 15 2015 13:32
true, I think api keys have to be attached to query after variables are applied
combination of both variables and query
Arik Fraimovich
@arikfr
May 15 2015 20:49
@sunandchakradhar key per variable & query: I assume you need this to embed the data in some other app, and maintain permissions?