Thoughts on adding support for queries with parameters in query results data source

Hi there,

BTW, here is new version of my PoC code on v7.0.0.

It supports nested query and alias.

Now you can run complex query like this.

select
    *
from (
    select
        1, current_timestamp, *
    from
        query_1('{"sheet_index": {{ sheet_index }}}') a
    limit 1
)
union all select
    2, *
from (
    select * from (
        select current_timestamp, * from query_1('{"sheet_index": {{ sheet_index }}}') b limit 2 offset 10
    )
)
union all select
    * 
from (
    select
        3, *
    from (
        select * from (
            select current_timestamp, * from query_1('{"sheet_index": {{ sheet_index }}}') c limit 3 offset 20
        )
    )
);

Enjoy!

1 Like

Hi @ariarijp
I just deployed image: redash/redash:7.0.0.b18042. but there is no ‘Query Results with parameters(PoC)’ data source in my data sources list. should I do anything else?

Hi @Nima

Thank you for asking me.

You should clone my forked repository from GitHub and checkout poc-query-results-with-params branch.

Then, you can build and run my PoC code included Docker image.

Thanks,

1 Like

Thanks a million @ariarijp.
It works great

1 Like

hi @ariarijp, I want pass the parameter which from other query result, eg:
Query 1

SELECT action as a1, obj_type as ot1
FROM query_1;

Query 2

SELECT *
FROM query_1('{"action":"$a1", "object_type":"$ot1"}');

In Query 2 sql, $a1 and $ot1 represent the value query from Query 1. How could I write Query 2 sql with your json input parameter?

Hello,

Was this feature ever deployed to reDash?

Thanks

3 Likes

I would love to use this feature. Guys, is there any news about pushing it into master?

3 Likes

Ping. What’s the status of this today? Currently I get Error running query: 'query_<id>' is not a function when running SELECT * FROM query_<id>('{"some":"json"}').

However I am not an admin for my organizations Redash account, and I don’t know what version we are using.

Is this feature stable and working in master and we are behind in pulling the latest?

1 Like

Any plans to support parameters in ‘query results’?

Hey, @ivanli1990

My PoC code is only focused like below situation.

-- query 1
SELECT {{ a }} as a. {{ b }} as b;

-- query 2
SELECT * FROM query_1('{"a":1, "b":2}');

You cannot pass parameters from query_1 to query_2.

Thanks

Hey @ariarijp - cool PoC. Did you already submit a pull request to master? Would be nice to get this in the official product

1 Like

Agreed this would look great in the finished product. It’s not on the immediate horizon until the React, RQ, and Python 3 migrations are complete later this quarter. When it becomes available we’ll announce it on the user forum.

2 Likes

Hi, folks

Thank you for your feedback for my implementation.
It would be greatly appreciated!

I hope to merge it to upstream in the near future.
But I think we have to care about stability, security and maintainability of it.

I think my implementation is one of the choices for solving issue of Query Results.
I would like to polish it and I’m looking forward to someone’s another shiny implementation.

Thank you

Any movement on this? This would be extremely helpful for my company

1 Like

No movement. It’s not a development priority for the team and I don’t believe we have an open pull request for it either.

Hi, there

Does anyone interested in this topic?

Now, I’m planning to re-build Parameter supported QRDS as Python package for Redash 9.0.0 or later.

If someone interested in it, please any comments or reactions for this post.

Thanks,

2 Likes

I hope this feature will be developed someday!

I have been hoping for years that this feature would be added. It would allow us to merge our sales data with our phone system data.

Is the plan to implement the exact solution outlined above or something different?

That will be built based on above my PoC for now.

If I made that as Python package, I want to split and organize some my complexed codes.

2 Likes