title: SQLAlchemy - using hybrid properties in a query
body: <p>I am trying to use a SQLAlchemy hybrid property like this</p>
  
  <pre><code>class Metric(Base):
      __tablename__ = 'metric'
      id = Column(Integer, primary_key=True)
      value = Column(Float, nullable=False)
  
      @hybrid_property
      def dominance(self):
          return 1 - abs(0.5 - float(self.value))
  </code></pre>
  
  <p>Now, I use this in my model like this</p>
  
  <pre><code>class MetricModel(BaseModel):
      def get_dominance(self):
          self.query(Metric).filter(Metric.dominance &gt;  0.5).order_by(Metric.dominance.desc()).limit(2).all()
  </code></pre>
  
  <p>This is a flask app and it's being called like this</p>
  
  <pre><code>model = MetricModel(db)
  with db.session():
      print(model.get_dominant_traits())
  </code></pre>
  
  <p>This gives me an error
  <code>
  TypeError: float() argument must be a string or a number, not 'InstrumentedAttribute'
  </code>
  From the error it looks like there is no result set, hence the failure. I followed the docs here <a href="http://docs.sqlalchemy.org/en/latest/orm/extensions/hybrid.html" rel="noreferrer">http://docs.sqlalchemy.org/en/latest/orm/extensions/hybrid.html</a>
  What should I do differently?</p>