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 a union query on the above 3 selecting only id,
> name and price (which are common fields).
> How do I do that? Could find the doc for union only in the non-orm
> case.
unions are accomplshed using the union() function, as in
union(select([table.c.x, table.c.y]), select([othertable.c.x,
othertable.c.y]))
> 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 would be
concrete table inheritance, described at
http://www.sqlalchemy.org/docs/04/mappers.html#advdatamapping_mapper_inheritance_concrete
.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---