SQLAlchemy custom sorting algorithms when using SQL indexes

Posted by David M on Stack Overflow See other posts from Stack Overflow or by David M
Published on 2010-04-18T02:53:20Z Indexed on 2010/04/20 8:23 UTC
Read the original article Hit count: 276

Filed under:
|
|
|
|

Is it possible to write custom collation functions with indexes in SQLAlchemy? SQLite for example allows specifying the sorting function at a C level as sqlite3_create_collation().

An implementation of some of the Unicode collation algorithm has been provided by James Tauber here, which for example sorts all the "a"'s close together whether they have accents on them or not.

Other examples of why this might be useful is for different alphabet orders (languages other than English) and sorting numeric values (sorting 10 after 9 rather than codepoint order.)

Is this possible in SQLAlchemy? If not, is it supported by the pysqlite3 or MySQLdb modules, or for any other SQL database modules supported by python for that matter?

Any information would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about python

Related posts about sqlalchemy