Thanks Michael

I struggle sometimes to find examples of the simple things, so eventually 
searched out the like_op as it was in the same place as eq() etc.

So, on that subject - is it better to use query.where(eq(a, b)) or 
query.where(a==b), or does it make no difference really?  

> not sure why the "like_op" and "nolike_op" have come into your normal 
> vocabulary here as they are usually just the ops used internally.
> 
> LIKE is column.like(other) and NOT LIKE is ~column.like(other).
> 
> 
> On Aug 22, 2012, at 9:15 PM, Warwick Prince wrote:
> 
>> Hi 
>> 
>> When creating a basic query, how does one code a NOT LIKE using SA?
>> 
>> I can do this;
>> 
>> query = table.select().where(like_op(table.c.name, 'fred%'))
>> 
>> I can not find a NOT LIKE operator.  The ones there "notlike_op" and 
>> "notilike_op" raise NotImplemented.
>> 
>> I've placed it in as text('%s NOT LIKE "%s"') % (column, value) for now, but 
>> I just KNOW that's going to blow up when I change databases down the track..
>> 
>> Is there another way?   I've been burnt badly recently changing from MySQL 
>> to Postgres with text(), so I'm trying to avoid at all costs! :-)
>> 
>> Cheers
>> Warwick
>> 
>> -- 
>> 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 
>> sqlalchemy+unsubscr...@googlegroups.com.
>> 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 sqlalchemy@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> 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 sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to