[sqlalchemy] Re: result as the dict()

2008-07-07 Thread Bobby Impollonia
MyBase = type(MyBase, (Base, MyMixin), {}) Is this any different than just doing class MyBase(Base, MyMixin): pass ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group,

[sqlalchemy] Re: result as the dict()

2008-07-06 Thread Michael Bayer
On Jul 6, 2008, at 1:16 AM, Empty wrote: You might want to look into the new instrument_declarative function in 0.5. It allows you to wrap a class with the declarative functionality without using the metaclass. This should permit you to work with a subclass, although I haven't tried it.

[sqlalchemy] Re: result as the dict()

2008-07-06 Thread Russell Warren
it also accepts cls as a keyword argument which is used as the base class: Base = declarative_base(..., cls=MyMixin) you can also add a mixin to any class in Python like: Base = declarative_base(...) MyBase = type(MyBase, (Base, MyMixin), {}) Thanks! Both are

[sqlalchemy] Re: result as the dict()

2008-07-06 Thread Russell Warren
Spoke a bit to soon... looks like that cls argument is only available in 0.5, and the type() mixin trick still complains about not having a mapped_table specifed. SQLA 0.4.6 is unhappy with the snippet below... import sqlalchemy as sa from sqlalchemy.ext.declarative import declarative_base

[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: 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 =