On Oct 19, 2007, at 6:01 PM, mhearne808[[insert-at-sign-here]]gmail [[insert-dot-here]]com wrote:
> > Does anyone have any examples of using more complex classes with > sqlalchemy? I'd like to have a user interface for my objects that > hides as much of the complexity of sqlalchemy as possible. Using the > users/addresses example from the sqlalchemy website (http:// > www.sqlalchemy.org/docs/04/ormtutorial.html#datamapping_tables), I'd > like to be able to have a User class that provides a method like: > > getAddresses() > > where this returns a list of (for example) email addresses from the > addresses table, hiding the sqlalchemy syntax from the user. > > However, I can't see how to add a method like this to the existing > users table, since then it would have to know about the users_table > Table object. > > I'm currently working with wrapper classes around the low-level User > and Address objects, but that's getting a little hairy too... > theres no "low-level" User and Address object...those are your classes, and can define whatever behaviors you want. getAddresses() would be a method on the User class which accesses the "addresses" property. theres no direct access to any Table objects required. hope this helps.... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---