Great,
I'll check out the latest revision. There was another issue that I ran
into a couple hours ago. That is, if you turn database echo on for the
test2 example you can see that every time you make a call like
Test.get(1) or Test.get(2) the object is reloaded from the database. I
believe that this is because identity_key is called on the Test classes
mapper so you get something like (<class 'Test'>, (2,)) as the
identity_key, but then when a Test2 or Test1 does a lookup it uses
a key like (<class 'Test2'>, (2,)). A very quick hack I did
was to change mapper.py so the identity_key function looked like this:
if hasattr(self.class_, '_base'):
return objectstore.get_id_key(tuple(primary_key), self.class_._base)
return objectstore.get_id_key(tuple(primary_key), self.class_)
Then I added _base = Test to both the Test1 and Test2 class. I know
this is a very fragile and far less than ideal fix -- I was just trying
to isolate the problem. I'm not sure where that information could or
should actually be stored.
Thanks again for extending the code to make these examples possible.
-Michael
- [Sqlalchemy-users] Class Inheritance / Polymorphism Michael Carter
- Re: [Sqlalchemy-users] Class Inheritance / Polymorphis... Michael Bayer
- Re: [Sqlalchemy-users] Class Inheritance / Polymorphis... Michael Bayer
- Re: [Sqlalchemy-users] Class Inheritance / Polymor... Michael Carter
- Re: [Sqlalchemy-users] Class Inheritance / Pol... Michael Bayer
- Re: [Sqlalchemy-users] Class Inheritance /... Michael Carter
- Re: [Sqlalchemy-users] Class Inherita... Michael Bayer
- Re: [Sqlalchemy-users] Class Inhe... Michael Carter
- Re: [Sqlalchemy-users] Class ... Michael Carter
- Re: [Sqlalchemy-users] Class ... Michael Bayer
- Re: [Sqlalchemy-users] Class ... Michael Carter

