title: How to retrieve pyodbc row for given value
body: <p>I have a pyodbc object returned from a <code>cursor.fetchall(query)</code> command which contains 4 columns and several rows.  I would like to be able to find the index of a row (or set of rows) based on a value in one of the columns.</p>
  
  <p>So say that 7 rows in column 3 contain the value 'X'.  How can I find the indices for rows in my pyodbc object where column 3 = 'X'?</p>
  
  <p>My guess is something like below which of course doesn't work since index is not defined for all_products.</p>
  
  <pre><code>cursor.execute("select distinct product1, product2, product3, product 4 from myschema.mytable")
  all_products = cursor.fetchall()
  print(all_products[3].index(str('X')))
  </code></pre>
  
  <p>EDIT: added some more code to clarify my example.</p>