-----sqlalch...@googlegroups.com wrote: -----

To: sqlalchemy@googlegroups.com
From: "Michael Bayer" <mike...@zzzcomputing.com>
Sent by: sqlalchemy@googlegroups.com
Date: 04/16/2010 02:57PM
Subject: Re: [sqlalchemy] Concrete table inheritance without a master table

w...@nobleenergyinc.com wrote:
> Here's the issue, boiled down to one file.  On import, the last statement
> fails, mapping the Connections object. I just need to map two relations on
> an association object (Connections) to a polymorphic union (NetworkNode).
> Is there a way to do this?

your "foreign_keys" is outside of "downstreamnodes" and is being set up as
a relationship() of its own.  corrected:

connmapper = orm.mapper(Connection,cnct,properties=dict(
                            upstreamnodes=orm.relation(NetworkNode,primaryjoin=
                              and_(cnct.c.downstream_id==nn.c.node_id,
                                   cnct.c.downstream_type==nn.c.node_type),
                            foreign_keys=[nn.c.node_id,nn.c.node_type]),
                            
downstreamnodes=orm.relation(NetworkNode,primaryjoin=
                              and_(cnct.c.upstream_id==nn.c.node_id,
                                   cnct.c.upstream_type==nn.c.node_type),
foreign_keys=[nn.c.node_id,nn.c.node_type]),
                            ))

Thank you for correcting that bonehead mistake.  Is there a way to make the 
polymorphic identifier generated by polymorphic_union numeric?

Wes Dyk

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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.

Reply via email to