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 
have much use for a __json__() method. It seems like the JSON serialization 
rightfully belongs in the Pyramid code where it's actually being used. 
That's a slightly contrived example, but it gets the flavor.

So my checklist of options seems to be:
1) Each application has it's own model definition, even though they 
interact with the same database. That means modifying several codebases any 
time the underlying DB changes.
2) Use one of the above provided methods to subclass the ORM objects in 
each codebase to provide the added functionality. Alterations tend to be 
localized, but it may be ugly and "unpythonic". I can see the possibility 
of brittleness.
3) Monkey patch the needed functionality. I'm not sure why, but this just 
bugs me.
4) Use reflection. I can't really speak here - I haven't played with 
reflection much. It still seems like there may be a fair bit of duplicated 
code between applications, although far less than individual copies of the 
model.
5) Use a programmatic interface or RPC of some kind between the model and 
the application. I've considered this several times and keep discarding it. 
Adding another layer of abstraction just seems like asking for problems. 
And I'm just moving the application-specific special cases to the middle 
layer.
6) Some obvious, dumb thing I'm missing. Maybe the design is rotten at the 
foundation.

Thanks again for the ideas. And I'm always open to suggestion.
Noah



-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to