title: sqlalchemy.exc.InvalidRequestError: SQL expression, column, or mapped entity expected
body: <p>I am running into this sqlachemy error that I haven't been able to understand:</p>
  
  <pre><code>sqlalchemy.exc.InvalidRequestError: SQL expression, column, or mapped entity expected - got '&lt;class '__main__.JobRecord'&gt;'
  </code></pre>
  
  <p>What does this error mean? What are possible causes?</p>
  
  <p>This is the method that triggers the error:</p>
  
  <pre><code>@classmethod
  def find_job_record_from_pk(cls, pk):
      '''
      return the job record with the given pk
      '''
      job_record = MlcDb.get_session().query(cls).filter(cls.pk == pk).first()
      return job_record 
  </code></pre>
  
  <p>Mapping:</p>
  
  <pre><code>@classmethod
  def define_mapping(cls):
      '''
      SQLAlchemy mapping definition
      '''
      cls.mapper = mapper(cls, cls.table, 
          polymorphic_on = cls.table.c.item_type, 
          properties = {
              'item_type': synonym('_JobRecord__item_type', map_column=True),
              'version': synonym('_JobRecord__version', map_column=True),
              'state': synonym('_JobRecord__state', map_column=True),
              'date_created' : synonym( '_JobRecord__date_created', map_column=True)
          }
      )
  </code></pre>