On May 23, 2011, at 10:32 PM, Israel Ben Guilherme Fonseca wrote:

> D'oh, I figured myself, It was very easy. I just followed the guide again and 
> it worked. 
> 
> One question though. Let's use the guide example for this:
> 
> Let's say that AddressUser inherits(joined inheritance) from another class, 
> and that class have a id with the same name (user_id), I get a warning like 
> this:
> 
> Implicitly combining column address.user_id with column superclass.user_id 
> under attribute 'user_id'.  This usage will be prohibited in 0.7.  Please 
> configure one or more attributes for these same-named columns explicitly.
> 
> All ids are indeed, the same id so it seems ok for me. Why is it being 
> prohibited? Issued with advanced cases, or just to avoid hard-to-debug errors?

The map of the attribute "id" to two columns named "id" is based on their name 
alone, not that they actually have anything to do with each other.    If they 
do relate to each other, then you're fine, but otherwise yes it totally can 
confuse people.    This rule is suspended when using joined table inheritance 
since column names are already considered to be significant in that situation.


> 
> 
> 2011/5/23 Israel Ben Guilherme Fonseca <israel....@gmail.com>
> I have the following:
> 
> class Person(Base):
>    __tablename__ = 'pessoa'
>    id = Column("id_person"), Integer, primary_key = True)
>    name = Column(String)
> 
> class Teacher(Person):
>    __tablename__ = 'teacher'
>    id = Column("id_teacher", Integer, ForeignKey(Person.id), primary_key=True)
>    info = Column(String)
> 
> class Salary(Base):
>    __tablename__ = 'salary'
>   id = Column(String)
>   value = Column(Numeric)
> 
> That's ok, but I wanted to merge the Salary and Teacher objects following the 
> guide:
> 
> http://www.sqlalchemy.org/docs/06/orm/mapper_config.html#mapping-a-class-against-multiple-tables
> 
> Am I forced to map the Teacher and Salary in the non-declarative mode to 
> achieve this? It's nice to keep things declarative, because it automatically 
> create the __init__ method with the columns as parameters.
> 
> I have another classes that have relationships to those classes (and they are 
> declarative too), and things get nasty when I mix declarative with the 
> standard way.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalchemy@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.

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