this is just wild thinking -- and might not be possible.

I'm  wondering if anyone has some ideas on creating a relationship where 
only certain columns are queried during relationship loading.

I have a few relationships like this ( pseudocode )

    class Tag2Posting:
        tag_id INT
        posting_id INT

         tag = sa.relationship( Tag )
         posting = sa.relationship( Posting )


    class Tag:
         id  
         name 
         to_postings = sa.relationship( Tag2Posting )


    class Posting:
         id INT
         to_tags = sa.relationship( Tag2Posting )


accessing the relationship will pull the entire object.

      posting_a.to_tags -->generates--> "SELECT tag_id , posting_id FROM 
tag_2_posting"


I really only care about the "tag_id" , so I'd want to create a 
relationship that generates this sql :

      "SELECT tag_id FROM tag_2_posting"

that would probably create either an array of ids:

        posting_a.tag_ids = [1,2,3]


a similar , but different, concept would be an object where certain columns 
are Deferred when loaded through a relationship ( and normal otherwise ). 


this is a bad example, because i'm using a 2 column association object. 
 but it makes a lot of sense when there's no association object and you end 
up querying a ton of data that will not be used.

-- 
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/groups/opt_out.

Reply via email to