On 9/8/07, Lukasz Szybalski <[EMAIL PROTECTED]> wrote:
>
> On 9/7/07, Paul Johnston <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > >And if I wanted to select a year and group by year?
> > >"select User.Year from User group by User.Year"
> > > db.execute(select([User.Year]) ???
> > >
> > >
> > Have a look at http://www.sqlalchemy.org/docs/04/sqlexpression.html
> >
> Ok.
> Based on documentation.
> I do:
> import sqlalchemy
>   s2=sqlalchemy.select([User.c.YEAR])
> s3=s2.execute()
>
> Got all year fields. 1995,1995,1995,1996,1996......
> Now I want to group so I get just one.
>   s2=sqlalchemy.select([User.c.YEAR]).group_by(User.c.YEAR)
> But when I execute, I get:
> s3=s2.execute()
>
> Traceback (most recent call last):
>   File "<console>", line 1, in ?
> AttributeError: 'NoneType' object has no attribute 'execute'
>
> In docs they use conn.execute(s2)
> Is this a different execute that is being called from somewhere else?

I didn't read this thread from the beginning, but if you are using TG,
probably you are using SA <= 0.3.10, which means you don't have
generative select() constructs...

So you'll need to modify your code to (not tested):

s2=sqlalchemy.select([User.c.YEAR], group_by=[User.c.YEAR])
s3=s2.execute()


Cheers,

Roger

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to