Re: [sqlalchemy] Map to Arbitrary Select Using Raw SQL

2010-01-27 Thread Michael Chambliss
Michael Chambliss wrote: Michael Bayer wrote: On Jan 26, 2010, at 7:48 PM, Michael Chambliss wrote: Presently, I'm trying to determine the best way to map a class against an arbitrary select where the select is constructed from raw SQL. Based on this, it's possible using the expression

Re: [sqlalchemy] Map to Arbitrary Select Using Raw SQL

2010-01-27 Thread Michael Bayer
Michael Chambliss wrote: Hey Michael - thanks for the patient and helpful response. I played around with the from_statement() approach earlier today, but what I was able to derive seemed to follow the standard model of define table, define class, map table to class, execute query. That

RE: [sqlalchemy] Map to Arbitrary Select Using Raw SQL

2010-01-27 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Michael Bayer Sent: 27 January 2010 16:31 To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] Map to Arbitrary Select Using Raw SQL Michael Chambliss wrote: Hey Michael

Re: [sqlalchemy] Map to Arbitrary Select Using Raw SQL

2010-01-27 Thread Michael Bayer
Michael Chambliss wrote: vehicle_query = select v.vehicle_id as vehicle_id, v.name as vehicle_name, v.description as vehicle_description, vt.name as vehicle_type, vs.name as vehicle_status, v.modify_dttm as vehicle_modify_dttm

Re: [sqlalchemy] Map to Arbitrary Select Using Raw SQL

2010-01-27 Thread Michael Chambliss
King Simon-NFHD78 wrote: You'll have to give it a table name, which will have the effect of defining a Table object even though no such table exists in the database, but I don't think this matters. Then you could use the query that Mike suggested to actually retrieve rows Thanks, Simon - I ended

Re: [sqlalchemy] Map to Arbitrary Select Using Raw SQL

2010-01-26 Thread Michael Bayer
On Jan 26, 2010, at 7:48 PM, Michael Chambliss wrote: Hello, I'm new to SQLAlchemy (and really Python in general) and admittedly I'm probably not following the best process for learning it. Ultimately, I'd prefer to deal with raw SQL as opposed to working through the expression

Re: [sqlalchemy] Map to Arbitrary Select Using Raw SQL

2010-01-26 Thread Michael Chambliss
Michael Bayer wrote: On Jan 26, 2010, at 7:48 PM, Michael Chambliss wrote: Presently, I'm trying to determine the best way to map a class against an arbitrary select where the select is constructed from raw SQL. Based on this, it's possible using the expression builders: