I have a rather complex query that I've written in SQL

• The result-set is 6 columns (1 = timestamp, 2-6 = fkeys on tables/objects)
• The query involves 15 tables
• The query is about 100 lines of raw SQL
• The query is not fun, and apt to change
• There are 2 placeholders/bind variables to be executed

Eventually this will be a function or totally removed; it handles some 
newsfeed creation that would be better as a linked-list or publisher model.

In any event, I don't want to rebuild this in SqlAlchemy.  

Are there any recommended ways to handle this within the ORM?

I know I can just use session.execute with the bind variables...

but i was wondering if there was a way to make some sort of object in the 
ORM that could execute the query , describe the columns/relationships, and 
generate an eagerload.  for lack of a better description, I'm guess I'm 
talking about a read-only ORM class that is backed by a select function 
instead of a table.  

There are dozens of hidden gems in SqlAlchemy that I learn about each day. 
 I doubt there is anything like this, but I wouldn't be surprised if there 
were.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to