title: dbt jinja returning the results of a query
body: <p>I am trying to model the following situation:</p>
  <ul>
  <li><p>given some query, return multi-column result-set (e.g. <code>run_query</code> or <code>db_utils.get_query_results_as_dict</code></p>
  </li>
  <li><p>iterate over in a case/statment</p>
  </li>
  </ul>
  <p>for exmaple:</p>
  <pre><code>{% set conditions = dbt_utils.get_query_results_as_dict(&quot;select comment, criteria from &quot; 
  ~ ref('the_model') %}
  
  ...
  select case
  {% for condition in conditions %}
  when {{ condition[&quot;criteria&quot;] }}
  then {{ condition[&quot;comment&quot;] }}
  {% endfor %}
  </code></pre>
  <p>Have not been able to get this to work, any guidance appreciated.</p>
  <p>Some ideas I tried:</p>
  <ul>
  <li>get_column_values x2 and zipping them into a new list of tuples. <code>zip not recognised</code></li>
  <li>get the count(*) from <code>the_model</code> then trying to iterate over the range - ran into issues with types</li>
  <li>various <code>for</code> conditions <code>{% for k, v in conditions.items() %}</code></li>
  </ul>