On May 6, 2008, at 7:49 AM, Eric Lemoine wrote:

>
> Hello
>
> Here's my thing:
>
> I have two DB tables, refugees and offices, which are independent
> tables (no foreign key). I already have two mappers for those tables:
>
> mapper(Refugee, refugees_table)
> mapper(Office, offices_table)
>
> In addition to being able to do independent queries on each table, I'd
> like to do queries in both tables (UNION) and get results in objects
> of type Location (a Python class of my own). In other words, I'd like
> to do queries using session.query(Location).
>
> I've tried various things (Mapping a Class against Multiple Tables in
> the doc in particular), but with no luck.
>
> Does anyone have suggestions?


this would be concrete table inheritance:  
http://www.sqlalchemy.org/docs/04/mappers.html#advdatamapping_mapper_inheritance_concrete

Both Refugee and Office would need to include "Location" as at least  
one of their base classes.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to