Hello,
I'm attempting to user the declarative joined-table inheritance setup
described in the documentation. My classes are as follows

class Relatable(base.Base):
    PROFNOTE = 0

    __tablename__='relatables'
    guid = Column(String(32), primary_key=True)
    rel_type = Column('rel_type', SmallInteger, nullable=False)
    __mapper_args__ = {'polymorphic_on': type}

    def __init__(self, id):
        self.guid = id

class ProfNote(relatable.Relatable):
    __tablename__ = 'profnotes'

    guid = Column('guid', String(32), ForeignKey('relatables.guid'),
nullable=False)
    author_id = Column(Integer, ForeignKey('credentials.user_id'),
nullable=False)
    title = Column(String(320), nullable=False)
    abstract = Column(Text, nullable=False)
    published = Column(Boolean,  nullable=False)
    curriculum = Column(String(320), ForeignKey('curricula.name'),
nullable=False)

    __mapper_args__ = { 'polymorphic_identity' :
relatable.Relatable.PROFNOTE }

    def __init__(self, guid, title, abstract):
        relatable.Relatable.__init__(self, guid)
        self.title = title
        self.abstract = abstract
        self.published = False

I'm trying to insert into the database using the following code:

profnote = ProfNote('...guid...', 'Fake Title', '')
session.add(profnote)
session.commit()

However, insert only occurs into the relatables table. The profnotes
table remains empty. Why is the insert not occurring into the
profnotes table?

Regards,
Ryan

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to