title: Accessing the data from SQLalchemy query object?
body: <p>I am querying my database using the following command in python:</p>
  
  <pre><code>self.deleted_packages = model.Session.query(
              model.Package).filter_by(state=model.State.DELETED)
  </code></pre>
  
  <p>And I am accessing the above value in pkg as show below:</p>
  
  <pre><code>for pkg in self.deleted_packages: 
  </code></pre>
  
  <p>The output in pkg is :</p>
  
  <pre><code>&lt;Package id=563e0da3-6916-4158-bc9f-f11bf92d3240 
   name=asdacaasas 
   title=asdacaasas 
   version= url= author= author_email= maintainer= maintainer_email= notes= 
   license_id=cc-by 
   type=dataset
   owner_org=9b89900e-c4b8-413d-a8fe-edbe08641022 
   creator_user_id=30ad2d1c-f133-4458-9947-535e2718a898 
   metadata_created=2019-05-21 13:08:52.322015 
   metadata_modified=2019-05-21 13:08:59.946710 
   private=True 
   state=deleted 
   revision_id=5251e583-3a71-4189-8d4e-aaac8ac69927&gt;
  </code></pre>
  
  <p>I just require the package id in a variable. And when I try to do the following:
  p1=[x[0] for x in pkg]</p>
  
  <p>I get the following error:</p>
  
  <pre><code>p1=[x[0] for x in pkg]
  TypeError: 'Package' object is not iterable
  </code></pre>
  
  <p>Does someone know how can i store the value of just id : <code>563e0da3-6916-4158-bc9f-f11bf92d3240</code> in a variable from the above query result.?</p>