Reusing same variables across many questions?

We have many dozens of questions that use the same exact list of variables with the same configurations. When we want to add a new question or expand that list of variables, we have to make the change to all of these questions.

Doing this manually takes a ton of time. The SQL can be copy/pasted, but then we have to individually configure the variable (set the widget type, find the field to point it to, etc.) on each question. We are currently looking to add 20 more variables to about 60 questions, and it takes 5 clicks to do this for each variable on each question :fearful:

Example query:
select * from table
where true
[[and {{attribute_1}}]]
[[and {{attribute_2}}]]
[[and {{attribute_3}}]]
[[and 20 more attributes to be added here]]

So, 2 part question

  • Is there an easier way to do this than repeating the manual process across all questions? e.g. is there a way to “save” a variable so that it always has the same configuration?
  • We’re currently using Metabase v35. I see v36 has the ability to create snippets. Does this unlock what we’re looking to do? i.e. can the variable settings be saved as part of a snippet?

Hi @gillianwallis
I don’t see any way to do this in a “smart” way via the interface. I think you would need to dig into the application database and do the copy-pasting-updating there (always make sure you backup before touching the database).

Snippets (0.36.0) doesn’t store the variable settings, and Sub-Query (0.35.0) does store the variable, but currently Metabase doesn’t support parsing filters from nested queries, so that wouldn’t work (but likely wouldn’t work anyways, since you’re probably only looking to save parts of a query and not a full functional query)
https://github.com/metabase/metabase/issues/6449 - upvote by clicking :+1: on the first post