#NEWLINE# def _prep_for_joins( self , left_alias , subq_path ) : #NEWLINE# #INDENT# to_join = [ ] #NEWLINE# pairs = list ( subq_path . pairs ( ) ) #NEWLINE# for ( i , ( mapper , prop ) ) in enumerate ( pairs ) : #NEWLINE# #INDENT# if ( i > 0 ) : #NEWLINE# #INDENT# prev_mapper = pairs [ ( i - 1 ) ] [ 1 ] . mapper #NEWLINE# to_append = ( prev_mapper if prev_mapper . isa ( mapper ) else mapper ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# to_append = mapper #NEWLINE# #UNINDENT# to_join . append ( ( to_append , prop . key ) ) #NEWLINE# #UNINDENT# if ( len ( to_join ) > 1 ) : #NEWLINE# #INDENT# info = inspect ( to_join [ ( - 1 ) ] [ 0 ] ) #NEWLINE# #UNINDENT# if ( len ( to_join ) < 2 ) : #NEWLINE# #INDENT# parent_alias = left_alias #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if info . mapper . isa ( self . parent ) : #NEWLINE# #INDENT# parent_alias = orm_util . AliasedClass ( to_join [ ( - 1 ) ] [ 0 ] , use_mapper_path = True ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# parent_alias = orm_util . AliasedClass ( self . parent , use_mapper_path = True ) #NEWLINE# #UNINDENT# #UNINDENT# local_cols = self . parent_property . local_columns #NEWLINE# local_attr = [ getattr ( parent_alias , self . parent . _columntoproperty [ c ] . key ) for c in local_cols ] #NEWLINE# return ( to_join , local_attr , parent_alias )