[sqlalchemy] result as the dict()

2008-07-05 Thread zipito
Good day community, there was similar theme - which ended without answer. How can I convert mine query results to list of dicts. I.e. I want the following select = session.select(MineTableObject) res = select.fetchall() res_list_dict = [dict(r) for r in res] but that doesn't works. dict(r)

[sqlalchemy] Re: result as the dict()

2008-07-05 Thread Fotinakis
I was just looking for the solution to a similar problem... I think the way you're thinking about it actually does work...at least, it does for me! See below: y = select([table]).execute().fetchall() for x in y: ... print x.__dict__ ... {'_RowProxy__parent':

[sqlalchemy] Re: result as the dict()

2008-07-05 Thread Russell Warren
I also had this issue and searched around for an answer, but found nothing. In my case I;m using the orm and wanted to have those object properties that map to a table be wrapped up in a dict. The new SQLA book is enroute and I figured I'd look in there when I get it, but in the mean time I

[sqlalchemy] Re: Need help with the shard session and query get function

2008-07-05 Thread Empty
Jay, I looked at your code in detail and what I'm seeing is that the lookups are not even getting populated. It looks like there's no binding to an engine there, which points to a problem with your shard_chooser. What I would do is try to simplify it a bit. First realize that your lookup

[sqlalchemy] Re: result as the dict()

2008-07-05 Thread Empty
Hi Russell, On Sun, Jul 6, 2008 at 12:32 AM, Russell Warren [EMAIL PROTECTED] wrote: I also had this issue and searched around for an answer, but found nothing. In my case I;m using the orm and wanted to have those object properties that map to a table be wrapped up in a dict. The new SQLA

[sqlalchemy] Re: result as the dict()

2008-07-05 Thread Michael Bayer
On Jul 5, 2008, at 4:39 PM, zipito wrote: Good day community, there was similar theme - which ended without answer. How can I convert mine query results to list of dicts. I.e. I want the following select = session.select(MineTableObject) res = select.fetchall() res_list_dict =