6 Apr 18:59
Re: select only one column, not the whole record
From: Daniel Fetchinson <fetchinson <at> googlemail.com>
Subject: Re: select only one column, not the whole record
Newsgroups: gmane.comp.python.sqlobject
Date: 2008-04-06 16:59:56 GMT
Subject: Re: select only one column, not the whole record
Newsgroups: gmane.comp.python.sqlobject
Date: 2008-04-06 16:59:56 GMT
> > it will not be possible to achieve this with the regular
> > SQLObject-classes. All you can do is something like this:
> >
> > Yoursqlobject._connection.queryAll("select distinct ...") # hardcoded sql
> >
> > or, to maintain more flexibility:
> >
> > conn = Yoursqlobject._connection
> > conn.queryAll(conn.sqlrepr(Select(items=Yoursqlobject.q.column)))
>
> this won´t include DISTINCT in the sql. this will:
>
> results = conn.queryAll(conn.sqlrepr(Select(items=Yoursqlobject.q.column,
> distinct=True)))
Hi Frank, the hard coded query of course works but I'd like to have
something go through sqlobject. The Select( ) actually does the trick
of selecting only 1 column, thanks! But it does not accept 'distinct'
as a keyword argument, I wonder why.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Register now and save $200. Hurry, offer ends at 11:59 p.m.,
Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
RSS Feed