gadfly and SQL-LIKE

Aaron Watters aaron at
Wed Sep 3 18:13:33 CEST 2003

"Patrick W. Fraley" <patrick at> wrote in message news:<pan.2003. at>...
> Hi Everybuddy,
> I am having a little problem I can not find a solution for.
> I am trying to use the SQL-LIKE statement in gadfly.  After googling
> around I found out that it is not supported, and that on is supposed to
> use a regular expression.  All great, but there is nowhere a reference
> to be found on how to do this.  No examples, no nothing, just the 
> comment to use regular expressions.

As it currently stands what you need to do is evaluate the query
using gadfly, pull the query out into "normal" python, and then use
a python loop and string operations (such as regular expressions) to
choose the results you want (and throw out the others).

This will work for analogues of simple positive queries such as

select a,b
from t
where c like '%this%'

but may not for fancy queries involving "not in" and so forth -- which
would require a proper implementation of "like" in gadfly.  Sorry.

Probably the "right" way to fix this is to allow the importation of an
arbitrary function into gadfly from python, which wouldn't be too hard
but isn't trivial.
   -- Aaron Watters

ps: my copy of MSAccess doesn't support "like" properly either, fwiw...

to do is to be -- Sartre
to be is to do -- Marx
do be do be do -- Sinatra

More information about the Python-list mailing list