hello,

here's a test case:

https://gist.github.com/plq/5ed0c135222ea76d77fc (also see below)

is it possible to preserve the polymorphic_identity values of subclasses
that contain changes to non-sqla parts of a class?

I understand that the reason for this is D2.__mapper__.class_ != D2. Is
there a way to clone the class mapper and change just the mapped class?

best,
burak


ps: the test case:

 
from sqlalchemy import Column, Integer
from sqlalchemy.ext.declarative import declarative_base
 
Base = declarative_base()
 
 
class C(Base):
__tablename__ = 'C'
 
id = Column(Integer, primary_key=True)
t = Column(Integer)
 
__mapper_args__ = {
'polymorphic_on': t,
'polymorphic_identity': 1,
}
 
assert C().t == 1
 
class D(C):
__mapper_args__ = {
'polymorphic_identity': 2,
}
 
assert D().t == 2
 
class D2(D):
foo = 'bar'
 
assert D2().t == 2


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to