Gentlemen,

Thanks for the feedback.  The problem is that I'm writing a base class 
designed to be subclassed, and a method that will be inherited.  Therefore, I 
don't know when I'm writing the function what the names of the columns will 
be (except for the DateCol).  That's why I'm focused on passing a dict, which 
lets me write the logic while omitting a predicate.

Is there another method for building a select query that allows me not to 
hardwire the names of the columns into the code, that's also compatible with 
adding an inequality?

Can I do a dict-based select, then do a subselect involving the inequality?

TIA,
cs

On Tuesday 05 February 2008 04:00:10 Frank Wagner wrote:
> I think that it won´t be possible the way you want, but why dont you
> just pass your criteria like this:
>
> # didn´t test this one
> querySet = (Person.q.name == "jim", Person.q.age == 34,
> Person.q.timeStamp <= datetime.date(2007,1,1))
>
> # but this definately works
> querySet = AND(Person.q.name == "jim", Person.q.age == 34,
> Person.q.timeStamp <= datetime.date(2007,1,1))
> # or, equivalent:
> querySet = ((Person.q.name == "jim") & (Person.q.age == 34) &
> (Person.q.timeStamp <= datetime.date(2007,1,1)))
>
> persons = Person.select(querySet)
>
> this should work.
>
> On Feb 5, 2008 9:35 AM, Oleg Broytmann <[EMAIL PROTECTED]> wrote:
> > On Mon, Feb 04, 2008 at 11:33:21PM -0500, Christopher Singley wrote:
> > > I've made great use of passing dicts into select methods, e.g.:
> > > queryDict= {'name': 'jim', 'age':34}
> > > result = Person.selectBy(**queryDict)
> > >
> > > How can I combine a dict-based SELECT with an inequality?
> > > Like if I wanted to further refine the above query to filter
> > > for (e.g.) only those with timeStamp <= datetime.date(2007,1,1)
> >
> >    Hint: how can you express the ineqality with a dict?
> >
> > Oleg.
> > --
> >      Oleg Broytmann            http://phd.pp.ru/            [EMAIL 
> > PROTECTED]
> >            Programmers don't die, they just GOSUB without RETURN.
> >
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Microsoft
> > Defy all challenges. Microsoft(R) Visual Studio 2008.
> > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > _______________________________________________
> > sqlobject-discuss mailing list
> > sqlobject-discuss@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> sqlobject-discuss mailing list
> sqlobject-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to