title: SQLAlchemy order_by string column with int values
body: <p>I have a table with a String column but it holds only integers (as strings).</p>
  
  <p>Problem comes when I want to order_by this column on certain query. SQLAlchemy (or python more specifically) uses lexicographic order for strings, so</p>
  
  <pre><code>&gt;&gt;&gt; '100000' &lt; '99999'
  True
  </code></pre>
  
  <p>even when</p>
  
  <pre><code>&gt;&gt;&gt; 100000 &lt; 99999
  False
  </code></pre>
  
  <p>How can I achieve to order_by a numerical value of this string column?</p>
  
  <p>I currently have a query such as this:</p>
  
  <pre><code>session.query(TableName).filter(TableName.column == 'some_value').order_by(TableName.string_column_holding_integers).all()
  </code></pre>
  
  <p>Please mind that changing the type of the column to an integer is not an option, I need to order_by correctly (by numerical value) on the present conditions.</p>
  
  <p>Also just found that directly on the DB using SQL (this one is a MySQL DB) I cannot order by this column correctly, so I found that using a CAST(string_column_holding_integers AS unsigned) works here. But haven't found a way to do this one (the CAST part) directly on SQLAlchemy queries.</p>