On Jun 8, 2011, at 5:19 PM, Eric Ongerth wrote:

> # Meanwhile, the following way of doing it doesn't work.
> # But it seems like it would make sense and might be worth enabling.
> 
> class SomeClass(Base):
> 
>    __table__ = Table('sometable', Base.metadata,
>        Column('id', Integer, primary_key=True),
>        Column('discriminator', Text),
>        Column('data', Text))
> 
>    __mapper_args__ = {'polymorphic_on': 'discriminator',
>                       'polymorphic_identity': 'default'}
> 
> 


"polymorphic_on" someday might be able to handle more than just a column, and 
there's no dependency-oriented rationale for allowing the string there like 
there is with relationship(), so its better that it only accept the column for 
now, which you can do easily enough via 
{"polymorphic_on":__table__.c.discriminator} above.

> error it causes is not very clear.  The error would be fine if it
> quoted the piece of code which triggered it, for instance if it said:
> * AttributeError: 'str' object 'discriminator' has no attribute
> 'proxy_set'.

we have a canned "columns only" function used by relationship() to check its 
arguments, while there are probably a lot more places such a checker could go, 
its additionally affixed to polymorphic_on in r760197daa0c2.

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