On Jun 28, 2011, at 12:55 PM, Alexandre Conrad wrote:

> Hi list,
> 
> So I am working on a project with SQLAlchemy using MSSQL as a back-end
> DB and I need to add a "WITH (nolock)" statement to all my queries
> implicitly. Even for the .get(pk_id) method. Mike actually pointed me
> to the .with_hint() method on the Query object but I couldn't get it
> to work.
> 
> PS: I also noticed that there was a .with_lockmode() and I was
> wondering if that could help as this can be passed at the Session
> level, which implies that it will affect all queries (whatever this
> does).
> 

well with_hint() should add it but if you really want to be heavyhanded you can 
override the compilation of sqlalchemy.expression.sql.Select to do it, using 
the form described at:

http://www.sqlalchemy.org/docs/core/compiler.html#changing-the-default-compilation-of-existing-constructs




> Thanks,
> -- 
> Alex | twitter.com/alexconrad
> 
> -- 
> 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 
> 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 sqlalchemy@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