SQL user function returning list for IN clause

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Tue Oct 27 06:48:18 EDT 2009


In message <c601fad6-8126-4f43-
b768-62ad6e7ecca1 at r5g2000yqb.googlegroups.com>, Felix wrote:

> I want to run a query like
> 
> select * from table a, table b where a.foo IN foobar(b.bar)
> 
> where foobar is a user function (registered by create_function in
> pysqlite3) returning a list of integers. However such functions can
> only return basic data types so the above is invalid. I am wondering
> what the best way around this is.

Is it feasible to iterate over the entire inner join of both tables?

for entry in iterator("select a.foo, b.bar ... from a, b") :
    if foobarp(entry["a.foo"], entry["b.bar"]) :
        .... this is a combination I want ...




More information about the Python-list mailing list