On May 31, 2013, at 1:06 PM, developer.l...@gmail.com wrote:

> Hi. I have the following structuring of classes with a base class without a 
> table.
> 
> User(base):
>    address = relationship('Address', backref=backref("user", uselist=False))
>    address_id = Column(Integer)
> 
> Address(base):
>    __tablename__ = 'address'
>    info = Column(String(255))
>    Info2 = Column(String(255))
> 
> Employee(User):
>    __tablename__ = 'employee'
>    __mapper_args__ = {'concrete':True}
> 
> Manager(User):
>    __tablename__ = 'manager'
>    __mapper_args__ = {'concrete':True}
> 
> How is user going to be able to maintain the relationship with address 
> without a table, especially because the relationships are statically defined 
> using the class/table names? And what would be the best possible solution in 
> this case?

its an awkward scenario that I'd try to avoid, but there's an illustration of 
how to do this here:  
http://docs.sqlalchemy.org/en/rel_0_8/orm/inheritance.html#relationships-with-concrete-inheritance
 - note the relationship() is created explicitly on each child class.  The 
example includes a base table but that is optional.




-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to