On Apr 5, 2011, at 12:30 PM, Israel Ben Guilherme Fonseca wrote: > Thks for the insight Michael. > > With the @property solution, its not possible to make queries like > session.query(Person).filter(Person.address.street="Something") right?
that's not possible with standard SQLAlchemy expression constructs anyway. Normally you'd use Address.street to get clause elements against Address. You can use hybrids to create this effect fully (see http://www.sqlalchemy.org/docs/07/orm/extensions/hybrid.html ) > Cascade Saving/Updating in that instance should be a problem too. I tested > the composite solution, it's nice but the queries get a bit complex to do > when we want to restrict fields of the composite Object (because the need of > comparator and when we want only one field of the composite object in the > restriction not all of them). Not very straight forward. I'd argue the original usecase is not very straightforward either, if you have just one table you should map a class to it, then as far as nice accessor patterns, that's all Python convenience stuff you build yourself (like using hybrids above). I don't see much practicality in attempting to make the single table act 100% like two tables do with the ORM, such as being concerned about "casades"...there are no cascades, this is one table with no foreign key relationships. I see practicality in getting a pattern that works good enough to make coding against the model simple and straightforward. > > I really think that in real-world situations i would never want to make table > become two objects, it's much more easy(implementation and understanding) to > use just one object. I'm doing a paper about ORM solutions and that's why i'm > asking about this specific feature. well there's your answer... SQLAlchemy is about getting work done and not so much about academic exercises :). -- 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 sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.