Jack wrote:
> People can use string-based "primaryjoin" parameter to define the
> "sqlalchemy.orm.relation" instance if people use declarative base
> class. But the "__table__" attribute is not available. Look at this
> example.

its a limited subset of behaviors which are allowed within the evaluated
strings.  In this case, there is a check to ensure you aren't trying to
use a relationship() or other construct in your string, but it wasn't
prepared for an attribute that isn't mapped at all.  An informative error
message for that has been committed in r6143041d8c4a.

When two tables have the same column you need to name them with different
attributes in order to reference both.   The declarative docs certainly
need an example of this since it is a common use case:

class System(Base):
   ...
   sysid = Column(Integer, primary_key=True, autoincrement=True)
   ...

class Chassis(System):
    ...
    local_sysid = Column("sysid", Integer,
ForeignKey('tbl_system.sysid'),primary_key=True)
    blades = relation('Blade',
primaryjoin="Chassis.local_sysid==Blade.chassis_sysid",
backref='chassis')
    ...


-- 
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