Are there known issues that cause a query to fail to cache?

I am having an issue running a simple SELECT * FROM cached_query_15068. This returns Error running query: No cached result available for query 15068. I have run the underlying query many times with no apparent caching effect.

The underlying query uses parameters (hence the need to access the cached result), however I was able to successfully retrieve the cached result for an older query that uses similar parameters.

I am curious if this is a known issue, or if there are known actions to force a parameterized query to cache.

If query_15068 uses parameters then you can’t query it with the QRDS.

That shouldn’t be possible. Can you say more about how you did it?

[Edit]: I’ve added a note about this to the documentation.

TL;DR: make and save a change to a query to force it to be cached.

Additional info:

I found what I believe to be the answer.

I was able to get a query with params to successfully cache by making an arbitrary change (I added a column to the output with a string, eg. SELECT "junk" AS test, prev_col1, prev_col2... . Then I saved the query and ran the result.

The query was then cached successfully and accessible via QRDS, eg. SELECT * FROM cached_query_15068.

Which version of Redash are you running? This looks like a bug.

To clarify: eventually we’d like to add a means of properly bubbling up the parameters so you can use parameterized queries with QRDS. What you’ve described is an undefined behavior, though.

Did you ever complete the ability to use parameterized queries with QRDS?

Did you ever complete the ability to use parameterized queries with QRDS?

Nope. As always, we are happy to review a pull request implementing this behaviour. Otherwise it will be developed as we have resources to do so.