Re: [Sqlalchemy-users] Advanced inheritance

2006-02-28 Thread Michael Bayer
if you assign a mapper to Base and a separate mapper to Person youre going to have problems, since each class is associated with a mapper via an attribute "_mapper" attached to the class, and you effectively have two different mappers dealing with Person objects and its going to get ugly.

Re: [Sqlalchemy-users] Advanced inheritance

2006-02-28 Thread Marko Mikulicic
On 28.02.2006., at 20:10, Michael Bayer wrote: Ah nice. When I select objects from Person.select() I get the same instance. Is possible to obtain this behaviour using custom object creation? show me more specifically what you mean. from the previous attachments (augmented with prints)

Re: [Sqlalchemy-users] Advanced inheritance

2006-02-28 Thread Michael Bayer
On Feb 28, 2006, at 1:15 PM, Marko Mikulicic wrote: On 28.02.2006., at 17:37, Michael Bayer wrote: anyway, create_instance is not too different from the append_result you already figured out: class MyExt(MapperExtension): def create_instance(self, mapper, row, imap, class_):

Re: [Sqlalchemy-users] Advanced inheritance

2006-02-28 Thread Marko Mikulicic
On 28.02.2006., at 17:37, Michael Bayer wrote: how many classes do you want to be able to add to this ? doing a giant SELECT that outerjoins many tables, with only one being used for each row, will perform very poorly. 4-5 classes Yes it would be slow, but I see two alternatives: 1) h

Re: [Sqlalchemy-users] Advanced inheritance

2006-02-28 Thread Michael Bayer
On Feb 28, 2006, at 11:25 AM, Marko Mikulicic wrote: On 28.02.2006., at 16:09, Michael Bayer wrote: it seems to me it would be "easier" to just map against the actual SELECT statement that joins all three tables, and not use mapper inheritance for this. youd have one Mapper that knows a

Re: [Sqlalchemy-users] Advanced inheritance

2006-02-28 Thread Michael Bayer
yeah...the hack youre doing, while I havent looked into it deeply, I can tell is going to be very tricky to make that work. at the very least you want to be on the latest SVN since I committed some major fixes to inheritance this weekend. what I dont understand is, at what point do you wa

[Sqlalchemy-users] Advanced inheritance

2006-02-27 Thread Marko Mikulicic
Hello, I would like to have some classes derive from a common ancestor and access them all together having the mapper select the right class for each instance. I've done a little hack using MapperExtension and outerjoins, however there are some problems with this solution. See the attached