[Chicago] 2 unique keys in a python dict?

Massimo Di Pierro mdipierro at cs.depaul.edu
Thu Oct 9 23:16:00 CEST 2008

I am not suggesting using a web framework. I suggested using a DB +  
python based database abstraction layer (I do my examples in web2py  
because that is what I know best).

Lukasz said that, in fact, he is using SQLAlchemy.

Since Garrett mentioned Django (I did not) and I am not aware of how  
to use GROUP BY in Django, the conversation sidetracked.

My question still stands. How would I do a GROUP BY and a SUM of the  
grouped records in using Django without multiple queries?

I would honestly like to learn that.

Do you know?


On Oct 9, 2008, at 3:59 PM, Martin Maney wrote:

> On Thu, Oct 09, 2008 at 01:45:36PM -0500, Massimo Di Pierro wrote:
>> In a more concise terms. Say I have a table "mytable" with a column a
>> (double) and b (string) and want to read data in from a csv file,  
>> group
>> by b, add all a's for the same b and write the result back in CSV. In
>> web2py I do (complete code):
> I guess that's your hammer - this only made me wonder why anyone would
> use a web framework and a database for that problem.  Or what if
> anything it means that this is so nearly builtin to one.
> --
> Some kinds of waste really are disgusting. SUVs, for example,
> would arguably be gross even if they ran on a fuel which would
> never run out and generated no pollution. SUVs are gross because
> they're the solution to a gross problem. (How to make minivans
> look more masculine.)  -- Paul Graham
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago

More information about the Chicago mailing list