Thread: [SQLObject] newbie needs urgent help with Group By
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Sells, F. <fr...@ad...> - 2006-01-23 03:41:52
|
just started with SQLObject, really cool. but I've got to convert my old mysqldb stuff in a hurry to stay on schedule. I cannot find the syntax to use a group by. Here is a snippet below of my aborted attempt. It works until I add the group by --------------------------------- =20 def get_employees(self): =20 x =3D Punchlog.select( AND(Punchlog.q.ppid in self.options, Punchlog.q.eventtime<self.payperiod_end), =20 GROUPBY=3D'employee' ) =20 return x ---------------------------------------------------------------- I also tried "groupBy" which also failed. I'm sure this must be easy, and in the docs somewhere; a pointer in the right place to look would be greatly apprecieated. =0D --------------------------------------------------------------------------- The information contained in this message may be privileged and / or confidential and protected from disclosure. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to this message and deleting the material from any computer. --------------------------------------------------------------------------- |
From: Ian B. <ia...@co...> - 2006-01-23 06:21:39
|
Sells, Fred wrote: > just started with SQLObject, really cool. but I've got to convert my old > mysqldb stuff in a hurry to stay on schedule. > > I cannot find the syntax to use a group by. Here is a snippet below of my > aborted attempt. It works until I add the group by > > --------------------------------- > def get_employees(self): > x = Punchlog.select( AND(Punchlog.q.ppid in self.options, > Punchlog.q.eventtime<self.payperiod_end), > GROUPBY='employee' ) > return x > ---------------------------------------------------------------- > I also tried "groupBy" which also failed. > > I'm sure this must be easy, and in the docs somewhere; a pointer in the > right place to look would be greatly apprecieated. There isn't a way to do group by in SQLObject. You might want to look at the techniques presented for LEFT JOIN alternatives -- it might apply to your case too: http://sqlobject.org/FAQ.html#how-can-i-do-a-left-join -- Ian Bicking | ia...@co... | http://blog.ianbicking.org |