additionalScope for Query Library

Is it possible to use the additionalScope parameters for an imported Query Library query when calling trigger()? I am invoking imported queries in our Query Library via JS in our Javascript Query. The library query is a snowflake query.

I've confirmed that what I'm doing works with queries local to the app but I can't seem to get variables provided in additionalScope to affect variables in a query imported from our Query Library.

Happy to help but I need more context. Is is possible for you to post screenshots of what you are trying to do as well as code?

The context is I am building a dashboard which is made up of multiple apps (imagine an app for Overview, Growth, Retention). Each app has multiple tables (imagine mobile, desktop). Many tables across the apps use the same underlying query, just with different parameters so they import those queries from the Query Library (imagine a query called getInsights with variables like dateStart, dateEnd).

My current implementation uses a single OnRefreshEvent query (type Query JSON with SQL) which looks for changes on a variable to trigger a number of Imported Queries using Event Handlers. This is a screenshot of that setup: Markup 2022-04-09 at 11.51.31.png - Droplr

This works fine, but feels really slow - my hypothesis is that because I have so many variables for each imported query, it adds a lot of overhead in the variable chain for the browser to maintain. Further, the actual implementation is a bit hard to maintain - for example if I add a parameter to the query library query, I have to click into each imported query and set that value.

I'm trying to migrate to an implementation where (1) OnRefreshEvent is a JS Query (2) I import the query library query once and (3) the JS Query will call trigger() on the imported query, passing in the appropriate parameters. This is a screenshot of that setup: Markup 2022-04-09 at 11.56.34.png - Droplr

The problem I'm running into is that I cannot use additionalScope to pass variable values into an imported query library query. If I were to tweak the migrated implementation such that instead of importing the query library query, I were to call trigger() with additionalScope on a local query, this implementation works. However, the actual query is shared across so many apps so I'd like to make it a query library query.

Hope this helps to clarify. I'm happy to grab specific screenshots if it'd be helpful but wasn't quite sure what kinds of screenshots would help clarify. I really appreciate the help!

1 Like

Hi @huang3r! Passing parameters for an imported Query Library query when calling trigger() is working for me :thinking: Would you be able to share more screenshots of the additional scope?