I have a setup like this:

class Entity(object): pass
class Persoon(Entity): pass

entity_tabel = Table('contact', metadata,
                              Column('contactid', Integer, primary_key=True),
                              Column('voornaam', String(75)),
                              Column('naam', String(75)),
                              Column('organisatietypeid', Integer))

entity_mapper = mapper(self.Entity, entity_tabel,
                               polymorphic_on=entity_tabel.c.organisatietypeid,
                               polymorphic_identity=None)

persoon_mapper = mapper(self.Persoon,
                                inherits=entity_mapper,
                                polymorphic_identity=None,
                                properties={
                                      'achternaam':entity_tabel.c.naam})

Now, I want to add a 'Persoon':

p = Persoon()
p.voornaam = 'firstname'
p.achternaam = 'surname'
mySession.add(p)
mySession.commit()

But this leaves my 'naam' field to 'NULL'. Only if I do:


p = Persoon()
p.voornaam = 'firstname'
p.naam = 'surname'
mySession.add(p)
mySession.commit()

Things work as they should.

How is this possible? I thought that by saying:

properties={'achternaam':entity_tabel.c.naam}

you actually rename the column, but it seems it creates another
attribute which would lead to unexpected results in my case.

Anybody more info about this?

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to