all Column objects have to be on the base class if you're using single  
table inheritance.  declarative joins the Table and class definitions  
together, and the base class has to represent the Table completely.

On Dec 17, 2008, at 10:36 PM, Jeffrey wrote:

>
> below is ext.declarative.py's doc:
>
>    class Person(Base):
>        __tablename__ = 'people'
>        id = Column(Integer, primary_key=True)
>        discriminator = Column(String(50))
>        __mapper_args__ = {'polymorphic_on': discriminator}
>
>    class Engineer(Person):
>        __tablename__ = 'engineers'
>        __mapper_args__ = {'polymorphic_identity': 'engineer'}
>        id = Column(Integer, ForeignKey('people.id'),
> primary_key=True)
>        primary_language = Column(String(50))
>
> For single-table inheritance, the ``__tablename__`` and ``__table__``
> class
> variables are optional on a class when the class inherits from another
> mapped
> class.
>
>
> according it i think it should be like this:
>
>    class Engineer(Person):
>        __mapper_args__ = {'polymorphic_identity': 'engineer'}
>        primary_language = Column(String(50))
>
> but :
>  File "c:\python25\lib\site-packages\sqlalchemy-0.5.0rc1-py2.5.egg
> \sqlalchemy\s
> ql\expression.py", line 2636, in description
>    return self.name.encode('ascii', 'backslashreplace')
> AttributeError: 'NoneType' object has no attribute 'encode'
>
>
> what should i do? thanks
>
> >


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