title: Taking logarithm of value using SQLAlchemy - Flask/SQLAlchemy
body: <p>I am attempting to update the <code>score</code> attribute of <code>User</code> to the logarithm of the existing <code>score</code>. However, I do not understand how I can bind a math function to <code>sqlalchemy.sql.func</code>.</p>
  <p>For example:</p>
  <pre class="lang-py prettyprint-override"><code>import math
  from sqlalchemy.sql import func
  
  
  def mul_2(user):
      return user.score * 2
  
  def _log(user):
      return func.math.log(user.score)
  
  
  # This works fine
  User.query.update({User.score: mul_2(User)})
  
  # This fails
  User.query.update({User.score: _log(User)})
  </code></pre>