title: Get column names Dynamically with SQLAlchemy
body: <p>I am querying sqlite db with SQLAlchemy like this:</p>
  
  <pre><code>import db
  
  ...
  
  results = session.query(table).all()
          for result in results:
              print result
              print "how to print column name?"
  </code></pre>
  
  <p>Here is a snippet from db class:</p>
  
  <pre><code>class Device(Base):
      __tablename__ = "devices"
      name = Column(String(250), primary_key=True)
      location = Column(String(250), nullable=False)
  
      def __init__(self, name, location):
          self.name = name
          self.location = location
  </code></pre>
  
  <p>Attempting to use ".column_descriptions" on result as per the documentation throws "'list' object has no attribute 'column_descriptions'" error.</p>
  
  <p>What is the proper way of getting column names dynamically along with the values? I want this so I can build a single function to handle json conversion of all queries instead of repeating code all over the place.</p>