On Dec 6, 2012, at 3:17 PM, junepeach wrote:
>
> For case insensitive columns:
> MySQL - use utf8_general_ci
> SQLite - use NOCASE collation
>
> ....
>
> Can migration tool handle that for most databases or it should be better done
> in application code?
sure:
def character_type(length):
return VARCHAR(length).with_variant(
VARCHAR(length, collation='utf8_general_ci'), 'mysql'
).with_variant(
VARCHAR(length, collation='NOCASE'), 'sqlite'
)
Table("sometable", metadata,
Column("some_text", character_type(200))
)
http://docs.sqlalchemy.org/en/latest/core/types.html?highlight=with_variant#sqlalchemy.types.String
http://docs.sqlalchemy.org/en/latest/core/types.html?highlight=with_variant#sqlalchemy.types.TypeEngine.with_variant
>
> Thanks and best regards,
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/sqlalchemy/-/cgxdiM7P4yMJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.