On Dec 9, 2010, at 11:02 AM, Ralph Heinkel wrote:

> Some months ago I had started a discussion about the ROW_NUMBER() OVER
> support being dismissed from SA since 0.5.x (http://groups.google.com/
> group/sqlalchemy/browse_thread/thread/74a8213886de6aeb/
> 25ee22fd71015485)
> 
> In our case we have queries being more than 6 times slower (>30sec) if
> ROW_NUMBER() OVER is not applied. This is why I used to patch the SA
> 0.5.x series to apply it again (taken from SA 0.4.x)
> 
> Now with switching over to 0.6.x (and soon to 0.7) I would like to
> apply the SA compiler feature (http://www.sqlalchemy.org/docs/core/
> compiler.html) and avoid patching. Unfortunately the docs are sort of
> sparse in that area, at least I have no clue how to really implement
> this feature.
> 
> Some of my questions are:
> Which would be the correct visit__* (or similar) function?
> How do I apply this to my models, can I apply this just to certain
> models?
> 
> Any initial information boost is highly appreciated.

the recipe for built in ROW_NUMBER() for LIMIT/OFFSET should be a drop in and 
is at:

http://www.sqlalchemy.org/trac/wiki/UsageRecipes/WindowFunctionsByDefault

applying to certain domain objects only would be a little more involved.   
You'd probably want to place some kind of "hint" on the statement that the 
custom compiler picks up on, or perhaps it looks at the table being selected to 
make this determination.



> 
> Thanks,
> 
> Ralph
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to