title: Mapper could not assemble any primary key columns
body: <p><a href="https://i.stack.imgur.com/AUmnY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/AUmnY.png" alt="enter image description here"></a></p>
  
  <p>I have created a tmp table from a sqllite table which is a subset of the original table based on various selection criteria. A sample is in the screenshot.</p>
  
  <p>I'm trying to loop through the table records one at a time in order to update a field in each. I have:</p>
  
  <pre><code>source_table= self.source
  engine = create_engine(db_path)
  Base = declarative_base()
  # metadata = Base.metadata
  # Look up the existing tables from database
  Base.metadata.reflect(engine)
  
  # Create class that maps via ORM to the database table
  table = type(source_table, (Base,), {'__tablename__': source_table})
  
  Session = sessionmaker(bind=engine)
  session = Session()
  i = 0
  for row in session.query(table).limit(500):
  
      i += 1
      print object_as_dict(row)
  </code></pre>
  
  <p>But this gives:</p>
  
  <pre><code>ArgumentError: Mapper Mapper|tmp|tmp could not assemble any primary key columns for mapped table 'tmp'
  </code></pre>
  
  <p>How can I perform this loop ?</p>