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:
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()
I must have it wrong, I admit I don't quite understand the arguments
of .with_hint()
session.query(User).with_hint(User, 'WITH (nolock)').get(1)
if that makes any sense (I wonder why I'd need to pass the User object again).
2011/6/28 Michael Bayer mike...@zzzcomputing.com:
On Jun 28, 2011, at
On Jun 28, 2011, at 2:55 PM, Alexandre Conrad wrote:
I must have it wrong, I admit I don't quite understand the arguments
of .with_hint()
session.query(User).with_hint(User, 'WITH (nolock)').get(1)
if that makes any sense (I wonder why I'd need to pass the User object again).
well HINT
On Jun 28, 2011, at 2:55 PM, Alexandre Conrad wrote:
I must have it wrong, I admit I don't quite understand the arguments
of .with_hint()
session.query(User).with_hint(User, 'WITH (nolock)').get(1)
if that makes any sense (I wonder why I'd need to pass the User object again).
We have to use the 'WITH (nolock)' because of legacy requirements; however,
we will look into the isolation level comment and see what our DBAs say.
Oh, and thanks for the help Mike, we'll test that patch and see if it works
and report back (along with anything we get on the isolation level).