title: How to print all columns in SQLAlchemy ORM
body: <p>Using SQLAlchemy, I am trying to print out all of the attributes of each model that I have in a manner similar to:</p>
  
  <pre><code>SELECT * from table;
  </code></pre>
  
  <p>However, I would like to do something with each models instance information as I get it. So far the best that I've been able to come up with is:</p>
  
  <pre><code>for m in session.query(model).all():
      print [getattr(m, x.__str__().split('.')[1]) for x in model.__table__.columns]
      # additional code 
  </code></pre>
  
  <p>And this will give me what I'm looking for, but it's a fairly roundabout way of getting it. I was kind of hoping for an attribute along the lines of:</p>
  
  <pre><code>m.attributes 
  # or 
  m.columns.values
  </code></pre>
  
  <p>I feel I'm missing something and there is a much better way of doing this. I'm doing this because I'll be printing everything to .CSV files, and I don't want to have to specify the columns/attributes that I'm interested in, I want everything (there's a lot of columns in a lot of models to be printed).</p>