ankane / blazer

Business intelligence made simple
MIT License
4.5k stars 471 forks source link

Allow Scoped Smart Variables #477

Open justwiebe opened 2 months ago

justwiebe commented 2 months ago

Thanks for such a great library! A feature that would be really great to add would be scoped/nested variables.

We would like to have a dashboard for "Users", but there are a lot of users in the system, so I would like to first scope the users to a specific account to make that more manageable.

This would be the smart variables definition. I would expect the user_id dropdown to be empty until I select an account_id, in which case user_id would be populated.

    smart_variables:
      account_id: 'SELECT DISTINCT a.id, a.name FROM accounts a'
      user_id: 'SELECT DISTINCT u.id, u.email FROM users u WHERE u.account_id = {account_id}'