I'm going through the wiki cookbook
http://docs.pythonweb.org/display/pylonscookbook/SQLAlchemy+for+people+in+a+hurry
and I'm discovering that even though 'model.class.c.column_name.like'
is available it doesn't perform a LIKE in the query.

from 'paster shell'

In [20]:
model.Accounting.select(model.Accounting.c.usr.like('TSmith'))
Out[21]:
[<syslogsql.models.Accounting object at 0x2626d70>,
 <syslogsql.models.Accounting object at 0x2626ad0>,
 <syslogsql.models.Accounting object at 0x2626910>]
In [22]: model.Accounting.select(model.Accounting.c.usr.like('Smith'))
Out[22]: []

...BUT...

In [23]: model.Accounting.select(model.Accounting.c.usr.like('%Smith
%'))
Out[27]:
[<syslogsql.models.Accounting object at 0x262d670>,
 <syslogsql.models.Accounting object at 0x2626d70>,
 <syslogsql.models.Accounting object at 0x2626ad0>,
 <syslogsql.models.Accounting object at 0x262d770>,
 <syslogsql.models.Accounting object at 0x262d790>,
 <syslogsql.models.Accounting object at 0x262d7b0>,
 <syslogsql.models.Accounting object at 0x2626910>]

Should I have to add the '%' around the string?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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