On Aug 22, 2012, at 11:38 PM, Warwick Prince wrote: > 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?
it makes no difference at all. The closest thing we have to a "rundown" of operators is here: http://docs.sqlalchemy.org/en/rel_0_7/orm/tutorial.html#common-filter-operators I suppose having an exhaustive list, with lots of links pointing to it, over here: http://docs.sqlalchemy.org/en/rel_0_7/core/expression_api.html would be helpful. > >> 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. > -- 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.