[sqlalchemy] Re: How to union with orm, or maybe class inheritance?

2008-06-17 Thread az
make ElProduct and FoodProduct inherit GeneralProduct. use joined_inheritance, and left-outer-joins instead of unions. at the end, query(GeneralProduct) will give u all the types. if u want just the GeneralProduct alone, that would be something like query(GeneralProduct).filter(

[sqlalchemy] Re: How to union with orm, or maybe class inheritance?

2008-06-17 Thread Michael Bayer
On Jun 17, 12:49 pm, Moshe C. [EMAIL PROTECTED] wrote: I have 3 tables: general_product {id, name, price} mapped to GeneralProduct electrical_product {id, name, price, voltage} mapped to ElectricalProduct food_product {id,name, price, calories} mapped to FoodProduct 1) I want to create

[sqlalchemy] Re: How to union with orm, or maybe class inheritance?

2008-06-17 Thread Moshe C.
regarding union, maybe I am missing something basic. I use the session.query() with the orm stuff. How do I get the selects from those ? On Jun 17, 8:23 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Jun 17, 12:49 pm, Moshe C. [EMAIL PROTECTED] wrote: I have 3 tables: general_product {id,

[sqlalchemy] Re: How to union with orm, or maybe class inheritance?

2008-06-17 Thread az
2) Since this smells of inheritance, I read about class inheritance mapping but couldn't decide if and which method applies here. Help would be greatly appreciated. I think svil's assumption of joined table inheritance is incorrect here, since each table contains name and price. This

[sqlalchemy] Re: How to union with orm, or maybe class inheritance?

2008-06-17 Thread az
2) Since this smells of inheritance, I read about class inheritance mapping but couldn't decide if and which method applies here. Help would be greatly appreciated. I think svil's assumption of joined table inheritance is incorrect here, since each table contains name and price. This

[sqlalchemy] Re: How to union with orm, or maybe class inheritance?

2008-06-17 Thread Michael Bayer
On Jun 17, 1:31 pm, Moshe C. [EMAIL PROTECTED] wrote: regarding union, maybe I am missing something basic. I use the session.query() with the orm stuff. How do I get the selects from those ? use the recipes outlined in the concrete table inheritance section. An example is there which shows