title: How to access SQLalchemy object in jinja template using column key
body: <p>I have a table <code>reference</code> with columns <code>id, parent, number, href</code>, when I want to access a particular row of that table, I pass the query object to the <code>render_template</code> method like so:</p>
  
  <pre><code>render_template('home.html',\
                 ref = db.session.query(reference).filter(reference.parent == 1).all())
  </code></pre>
  
  <p>Now whenever I want to access the first returned row, I use</p>
  
  <pre><code>{{ ref[0].href }}
  </code></pre>
  
  <p>What should I do to change the <strong>key</strong> from <code>0</code> to the value of say <code>number</code> column. I need this to access rows in the template not by their order, but by their column values, I.e.</p>
  
  <pre><code>{{ ref['column_value'].href }}
  </code></pre>