Using collation sequence in SqlAlchemy against Sqlite DB

794 views
Skip to first unread message

Roja Sen

unread,
Oct 18, 2011, 1:54:04 PM10/18/11
to sqlalchemy
Could someone help me to set different collation in sqlAlchemy against
Sqlite DB? I tried to execute something like SELECT
icu_load_collation('pl_PL', 'POLISH') when getting a connection but
couldn't
reference the collation sequence when creating the table object, I
keep
getting the following error.

*sqlite3.OperationalError: no such collation sequence: POLISH*

Michael Bayer

unread,
Oct 18, 2011, 2:11:44 PM10/18/11
to sqlal...@googlegroups.com
I don't know what icu_load_collation is, but SQLite's documentation points to section 6.2, "Collation Sequence Examples" at http://www.sqlite.org/datatype3.html which describes how to create tables with certain collations. There is also the COLLATE operator: http://www.sqlite.org/lang_expr.html#collateop . Built-in collations described there include BINARY, NOCASE, and RTRIM, that's it.

Your first step is to determine exactly what SQL you'd like to emit against your database using the "sqlite3" command line utility. Once you've identified the exact SQL conversation you'd like to have, it can be automated with SQLAlchemy through various means, possible features here include the func object as well as the "collate" function:

http://www.sqlalchemy.org/docs/core/expression_api.html#sqlalchemy.sql.expression.func
http://www.sqlalchemy.org/docs/core/expression_api.html?highlight=collate#sqlalchemy.sql.expression.collate

> --
> You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
> To post to this group, send email to sqlal...@googlegroups.com.
> To unsubscribe from this group, send email to sqlalchemy+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
>

Reply all
Reply to author
Forward
0 new messages