On Jan 12, 2009, at 11:37 PM, Duder wrote:
> missing from the object, so it is generating bad SQL. Is this a bug,
> or do I need to change something to be compatible with 0.5.0?


its impossible to say without a full reproducing test case.  I've  
tried many versions of the test below and none have any issue:

from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
import cPickle as pickle

engine = create_engine('sqlite://', echo=True)
Base = declarative_base()
class Person(Base):
     __tablename__ = 'people'
     id = Column('id', Integer, primary_key=True)
     name = Column('name', String(50))
     discriminator = Column('type', String(50))
     __mapper_args__ = {'polymorphic_on':discriminator}

class Engineer(Person):
     __tablename__ = 'engineers'
     __mapper_args__ = {'polymorphic_identity':'engineer'}
     id = Column('id', Integer, ForeignKey('people.id'),  
primary_key=True)
     primary_language = Column('primary_language', String(50))

Base.metadata.create_all(engine)

e1 = Engineer(name="dilbert", primary_language="java")

sess = sessionmaker(engine)()
sess.add(e1)

sess.commit()

e1 = sess.query(Person).filter(Person.name=='dilbert').one()

assert 'primary_language' not in e1.__dict__
assert 'name' in e1.__dict__

sess.expunge(e1)

# "serialize to the client"
e2 = pickle.loads(pickle.dumps(e1))

# client changes something (?)
e2.name = 'ed'

# "deserialize from the client"
e3 = pickle.loads(pickle.dumps(e2))

# merge
e1 = sess.merge(e3)
sess.commit()


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