On 3/26/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > As for using the attribute as query, I agree with Mike that > > attributes should maintain their special character, but I can see a > > case for extracting a query from the attribute to do arbitrary > > operations that don't impact the relation or the attribute itself. > > Given that that session.query() is now generative, this seems like > > a natural fit for the feature - turn an attribute into a query that > > you can do with as you please, the attribute remains as-is. > > maybe i don't get something here: > if user.my_green_addresses maps to user....select( color=green), how > would u prevent adding myredhouse to that collection? i.e. how would > this keep your-data consistent? In this meaning, collection is not > just a whatever query, it assumes some minimal validation part (A > relates to B), and subcollections would have even more of that.
This confusion is exactly why it's important to logically differentiate between the relation itself and any query that is "detached" from the relation. It makes sense (at least to me) that once the resultant query is separated/derived from the relation, that any "attached collection" semantics, and other relation-oriented semantics about that relation are detached as well, including any guarantees about polymorphic membership -- at that point, the query is nothing more than a normal garden-variety query: e.g. the whole idea of "add something to the collection" no longer makes any sense. The whole process is nothing more than the production of a query with some filter and order_by stuff already filled out. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
