Usually like this:

from sqlalchemy import func
query(Widget).filter(func.lower(Widget.name) == func.lower("Some name"))

if you're using "LIKE", you can use ILIKE instead which is built in:

Widget.name.ilike("Some Expression")



On Aug 31, 2011, at 8:27 AM, RVince wrote:

> I'm using Postgres and the end-users are complaining that the search
> features provided by the web app are case-sensitive (via Postgres). Is
> there a way to do a case-insensitive version of select statements? Not
> all statements are of the form "=" or "like" but often of the form
> "...where lastname >= 'smith';" Is there a way to do this type of case-
> insensitive comparison at the SQLAlchemy level? Thanks RVince
> 
> -- 
> 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.
> 

-- 
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.

Reply via email to