[sqlalchemy] Re: Polymorphic and inheritance with missing children

2008-02-12 Thread Michael Bayer
On Feb 11, 2008, at 10:25 PM, Richard Levasseur wrote: Ok, so I tried this. It works fine, the only catch is that yeah, the pid and cid are hardcoded in there. I couldn't figure out any way to determine them programatically. I can get the join condition clause, but its just a

[sqlalchemy] Re: Polymorphic and inheritance with missing children

2008-02-11 Thread Richard Levasseur
On Feb 8, 2008 2:27 PM, Michael Bayer [EMAIL PROTECTED] wrote: On Feb 8, 2008, at 3:49 PM, Richard Levasseur wrote: Hm, we could do that, but that means that we have to outerjoin to ~15 other tables. The primary table has ~200+ columns on it, each child table has 10-20 columns, there

[sqlalchemy] Re: Polymorphic and inheritance with missing children

2008-02-08 Thread Michael Bayer
On Feb 7, 2008, at 9:28 PM, Richard Levasseur wrote: Ok, so I've been looking into getting it to work when the child record doesn't exist. I haven't had much luck. I wrote a stub mapper extension for translate_row and populate_instance, but it doesn't seem to be called when it goes to

[sqlalchemy] Re: Polymorphic and inheritance with missing children

2008-02-08 Thread Richard Levasseur
On Feb 8, 2008 7:04 AM, Michael Bayer [EMAIL PROTECTED] wrote: On Feb 7, 2008, at 9:28 PM, Richard Levasseur wrote: Ok, so I've been looking into getting it to work when the child record doesn't exist. I haven't had much luck. I wrote a stub mapper extension for translate_row and

[sqlalchemy] Re: Polymorphic and inheritance with missing children

2008-02-08 Thread Richard Levasseur
On Feb 8, 2008 11:27 AM, Michael Bayer [EMAIL PROTECTED] wrote: On Feb 8, 2008, at 2:01 PM, Richard Levasseur wrote: Ok, so I'm talking about 2 slightly different things at once: One is that sqlalchemy doesn't call the mapper extensions when loading the data from the inherited tables. The

[sqlalchemy] Re: Polymorphic and inheritance with missing children

2008-02-07 Thread Michael Bayer
On Feb 7, 2008, at 1:33 PM, Richard Levasseur wrote: For the syntax of it, I'd go for something like `child_obj.change_from(parent_obj)` or `child_obj = ChildClass.create_from(parent_obj)`, perhaps implicitly invoked when you do child_obj.type = parent_obj. Not sure about that last part,

[sqlalchemy] Re: Polymorphic and inheritance with missing children

2008-02-07 Thread Richard Levasseur
On Feb 6, 7:01 pm, Michael Bayer [EMAIL PROTECTED] wrote: we dont yet support a seamless change of inheriting type. your best bet is to issue the SQL to the table directly which changes the polymorphic value to the new value, then inserting/deleting from the child tables as needed..then

[sqlalchemy] Re: Polymorphic and inheritance with missing children

2008-02-07 Thread Richard Levasseur
Ok, so I've been looking into getting it to work when the child record doesn't exist. I haven't had much luck. I wrote a stub mapper extension for translate_row and populate_instance, but it doesn't seem to be called when it goes to fetch the information for the child row. mapper(Parent,