[sqlalchemy] Re: Sub-classing declarative classes

2014-06-14 Thread Noah Davis
Thanks, both of you. That gives me even more to consider. The problem I'm trying to solve is one of application-specific logic. For example, if the model is used in a Pyramid app, having a __json__() method on each ORM object would be very useful. At the same time, a desktop application won't

[sqlalchemy] Re: Sub-classing declarative classes

2014-06-14 Thread Jonathan Vanasco
for what it's worth... if you use simplejson instead of json (many people do), there is a 'for_json' kwarg in the encoder... If *for_json* is true (not the default), objects with a for_json() method will use the return value of that method for encoding as JSON instead of the object. so

[sqlalchemy] Re: Sub-classing declarative classes

2014-06-11 Thread Jonathan Vanasco
On Tuesday, June 10, 2014 3:47:00 PM UTC-4, Noah Davis wrote: I suspect there's some way to tell the ORM to Do The Right Thing here, but I have no idea what it might be. I'd like the particular applications to be as unaware of the underlying table information as possible. I guess in

[sqlalchemy] Re: Sub-classing declarative classes

2014-06-10 Thread Noah Davis
Sorry, poor choice of words on my part, there. I meant do the Right Thing by the model I was trying to construct. Both of these examples are exactly what I was looking for - something to point me in the right direction. I'm also not convinced my model is the best solution to my problem, but at