title: How to get sqlalchemy to throw an error when a order_by is attempted on a Text column?
body: <p>I need SQLAlchemy to throw an error if we try to do an order_by operation on a Text column. This is done as Oracle does not support order_by operation on Text.</p>
  <p>I achieved doing this by:</p>
  <pre><code>@compiles(Select)
  def compile_sort_on_text_for_oracle_compat(select_stmt, compiler, **kw):
      for sort_col in select_stmt._order_by_clause.clauses:
          if isinstance(sort_col, Column) and isinstance(sort_col.type, Text):
              raise AssertionError(
                  '&quot;Sort By&quot; should not be done on a Text column as it is not supported in Oracle. '
              )
      return compiler.visit_select(select_stmt, **kw)
  </code></pre>
  <p>But as you can see I am using a Generic <code>Select</code> over here.
  I want to know if there is a better way of doing this ? (like compiling Clause instead of Select)</p>