title: How to calculate max using postgres dialect in sqlalchemy hybrid function
body: <p>I've defined a hybrid property:</p>
  <pre><code>@hybrid_property
  def result(self):
      return max(0, self.impact - self.protection)
  
  @result.expression
  def result(cls):
      return func.max(0, cls.impact - cls.protection)
  </code></pre>
  <p>However the Postgres <code>max</code> function only operates on columns, unlike e.g. sqlite so the expression won't work. Is there something I could use in the <a href="https://docs.sqlalchemy.org/en/14/core/sqlelement.html" rel="nofollow noreferrer">Column elements or expressions</a>, or some other way I can clamp my value to a lower bound of 0?</p>