That's what the association proxy does:

  
  http://docs.sqlalchemy.org/en/rel_0_9/orm/extensions/associationproxy.html




On Tuesday, February 10, 2015 at 8:47:29 PM UTC-5, Dun Peal wrote:
>
> I have a declarative base called Foo, instances of which get most of their 
> attributes from a Foo SQL table. However, Foo also has a bar_id attribute, 
> which is a foreign key linking to the primary key of a Bar table. Bar is 
> really just an extension of Foo, with a few extra attributes that belong in 
> Foo, but aren't in the Foo table for technical reasons.
>
> Is there any way to combine the tables seamlessly, so that when I 
> instantiate a Foo, the underlying query would automatically JOIN on 
> Foo.bar_id and attach all JOINed data onto the new instance, such that if 
> qux is a field on Bar, foo.qux would retrieve the value of Bar.qux from 
> foo's corresponding row on Bar?
>

-- 
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/d/optout.

Reply via email to