On Friday, October 3, 2003, at 01:40 PM, Brad Bollenbach wrote:
>> Ideally I'd like to be able to perform this type of query using
>> Python's "in" operator. From reading through SQLBuilder.py this seems
>> to be already overloaded to support SQL "something IN ('blah1',
>> 'blah2')" operations. Is there any way this could be inteligently
>> overloaded to perform like %% queries on strings and IN queries on
>> tuples?
>
> Python's "in" operator checks for the existence of a value in a
> sequence. What you're trying to do is ask for all the objects (or all
> the SQLObjects, as it were :) that meet a certain criteria. The
> semantics are different.
Not exactly -- SQLBuilder (which you get at with SomeSQLObject.q)
captures Python expressions (to the degree possible), which can then be
turned into SQL clauses. In this particular case ("in") I don't think
Python makes it possible to do this, but several operators can be
overloaded like this.
Ian
|