[Chicago] 2 unique keys in a python dict?

Massimo Di Pierro mdipierro at cs.depaul.edu
Thu Oct 9 20:26:51 CEST 2008

I do not know what tps files are but in web2py you can connect to  
multiple databases at once


process them

     for row in db1(...).select():  
     for row in db2(...).select():  

and you can serialize any select query back in CSV using str(..)


If this is useful, feel free to email me personally with more details  
and I am happy to answer any question.


On Oct 9, 2008, at 12:21 PM, Lukasz Szybalski wrote:

> On Thu, Oct 9, 2008 at 11:53 AM, John Hunter <jdh2358 at gmail.com>  
> wrote:
>> On Thu, Oct 9, 2008 at 11:19 AM, Massimo Di Pierro
>> <mdipierro at cs.depaul.edu> wrote:
>>>>>> rows 
>>>>>> = 
>>>>>> db 
>>>>>> ().select 
>>>>>> (db 
>>>>>> .mytable 
>>>>>> .ttid 
>>>>>> ,db 
>>>>>> .mytable 
>>>>>> .paid.sum(),orderby=db.mytable.ttid,groupby=db.mytable.ttid)
>>>>>> for row in rows:
>>> ... print 'transaction',row.ttid,'total  
>>> amount',row[db.mytable.paid.sum()]
>> Or use matplotlib's support for CSV files via numpy record arrays
>> import matplotlib.mlab as mlab
>> r = mlab.csv2rec('myfile.csv')
>> print r.paid.sum()
>> csv2rec does type inference from the data in the file, and numpy
>> arrays support all the standard math and stat operations (mean, std,
>> logical masks, etc...)
> This is a combination of sqlserver2000, clarion tps files via odbc,
> mysql server, all with different fields structure that at the end need
> to show up on the excel.
> Wish there was an easier way of merging these sources into some csv
> based reporting tool, getting the proper totals, and output final csv
> file in under 2 weeks.
> Lucas
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago

More information about the Chicago mailing list