Hi,

is there a way to map a class against an arbitrary SQL expression
(read-only would be OK)? I can't find the correct way to define the
selectable for the mapper.

Example:
this table:
carside_table = Table(
    'carside', metadata,
    Column('id', Integer, primary_key=True),
    Column('car_id', Integer),
    Column('side', Text),
    Column('temperature', Float),
)

with a dummy class;
class CarSide(object):
    pass

And I want to use this SQL expression to map the class:
SELECT
    left.car_id
    left.temperature AS left_temperature
    right.temperature AS right_temperature
FROM carside AS left
JOIN carside AS right
    ON left.car_id=right.car_id
WHERE
    left.side = "left" AND
    right.side = "right"
;

Many thanks,

Jan.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to