Aggregate funuctions broken in MySQLdb?

Lou Losee llosee at gmail.com
Mon May 15 16:09:24 EDT 2006


Try these:
http://sourceforge.net/docman/?group_id=22307

and for the Python DB API overall:
http://www.python.org/dev/peps/pep-0249/

Lou

On 5/15/06, Lorenzo Thurman <lorenzo at nospamthethurmans.com> wrote:
>
> Thanks, that was my problem. Can you point me to some documentation on
> MySQLdb? I've been googling to get answers and that obviously has not
> been working.
>
>
>
>
> In article <1147623011.319336.11820 at v46g2000cwv.googlegroups.com>,
> "Wade Leftwich" <wleftwich at gmail.com> wrote:
>
> > Works fine for me, and I certainly hope MySQLdb is ready for prime
> > time, because I use the heck out of it. Maybe you're getting fooled by
> > the fact that cursor.execute() returns the count of result rows. To
> > actually see the result rows, you have to say cursor.fetchone() or
> > fetchall() --
> >
> > In [34]: cur.execute("select article_id from articles limit 10")
> > Out[34]: 10L
> >
> > In [35]: cur.fetchall()
> > Out[35]: ((3L,), (4L,), (5L,), (6L,), (7L,), (8L,), (9L,), (10L,),
> > (11L,), (12L,))
> >
> > In [36]: cur.execute("select count(article_id) from articles where
> > article_id < 13")
> > Out[36]: 1L
> >
> > In [37]: cur.fetchall()
> > Out[37]: ((10L,),)
> >
> > In [38]: cur.execute("select sum(article_id) from articles where
> > article_id < 13")
> > Out[38]: 1L
> >
> > In [39]: cur.fetchone()
> > Out[39]: (75.0,)
> >
> > In [40]: cur.execute("select avg(article_id) from articles where
> > article_id < 13")
> > Out[40]: 1L
> >
> > In [41]: cur.fetchone()
> > Out[41]: (7.5,)
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Artificial Intelligence is no match for Natural Stupidity
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060515/5a2e17f9/attachment.html>


More information about the Python-list mailing list