getredash / redash

Make Your Company Data Driven. Connect to any data source, easily visualize, dashboard and share your data.
http://redash.io/
BSD 2-Clause "Simplified" License
26.5k stars 4.39k forks source link

Support for nested drop downs is much needed! #7052

Open nakamurau1 opened 4 months ago

nakamurau1 commented 4 months ago

Discussed in https://github.com/getredash/redash/discussions/6744

Originally posted by **NielsKSchjoedt** February 5, 2024 _This is a copy of: https://discuss.redash.io/t/observable-query-based-dropdown-list/3229_ Redash is such a great tool 🎉 - however, one thing I really lack is nested query based drop downs. Basically the idea is, that if your database has two columns, say: `country, city` then those could be used to populate two nested drop downs. One for country, one for city. However currently, that is not possible because the queries powering drop downs cannot interdepend: ![Skærmbillede 2024-02-05 kl 11 57 56](https://github.com/getredash/redash/assets/570755/79ef4cfb-9499-4ab5-8354-a343de1d41cf) **Example of what we need** You could have a query like: ```sql SELECT DISTINCT country FROM my_db.my_table ORDER BY country ``` Then add a "Query Based Drop Down" with those countries Then use the selected variable in another drop down query for city: ```sql SELECT DISTINCT city FROM my_db.my_table WHERE country = '{{country}}' ORDER BY city ``` It is such a pain this functionality does not exist 😬
nakamurau1 commented 4 months ago

@arikfr Hello,

I would like to get your advice on the following proposal.

📡 API

My proposal is to create a POST: /api/queries//dropdowns/ endpoint with similar functionality to POST: /api/queries//results.

💻 Frontend

I plan to add a new query parameter type called “Dynamic Query Dropdown.” When other parameters in the Dashboard or within the query change, this API will be called to update the dropdown content accordingly.

Are there any issues or concerns with this approach?

Thank you for your guidance! 🙏

nakamurau1 commented 4 months ago

Hi @justinclift,

I recently opened this issue (#7052) about adding support for nested query-based dropdowns in Redash. Could you take a look and provide any feedback or suggestions?

Thanks, @nakamurau1

gaecoli commented 2 months ago

Maybe you want to use xx.country and xx.city? And that just show one parameter xx?