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 > book is enroute and I figured I'd look in there when I get it, but in > the mean time I just added a cheap/crude method for conversion as per > below.
> I figure there must be a better way.. I had to dip into __mapper__, > which didn't seem right, but __dict__ obviously has more than what I > wanted. You could use: class_mapper(self).columns.keys() but I don't really know how that's any better. In addition, I had to use a mixin because with > ext.declaritive (which I like because it is less verbose) I couldn't > make a base class to derive from because it complained that I needed > __tablename__ in the base class. > 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. Michael Trier blog.michaeltrier.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
