Skip to content

Support "collation" option on String/Text types #81

Description

@kadler

String and Text both support a "collation" option to set the encoding of the parameter:

collation

Optional, a column-level collation for use in DDL and CAST expressions. Renders using the COLLATE keyword supported by SQLite, MySQL, and PostgreSQL. E.g.:

from sqlalchemy import cast, select, String
>>> print(select([cast('some string', String(collation='utf8'))]))
SELECT CAST(:param_1 AS VARCHAR COLLATE utf8) AS anon_1

We could allow users to specify a CCSID here, eg.

from sqlalchemy import cast, select, String
>>> print(select([cast('some string', String(10, collation=37))]))
SELECT CAST(:param_1 AS VARCHAR(10) CCSID 37) AS anon_1

I think we target this for a future version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions