I have a Django Model "Users" tied to an existing MS SQL Server database table. I am reading the table thus:
Users.objects.filter(userid='xyz').filter(status='active')
I want to know what locking constructs would this translate to, as in, would this sort of a read Lock the table? In SQL I would have done:
SELECT * from users (nolock) where userid='xyz' and status='active'
Is there a way to explicitly specify a "nolock" via Django Model queries?
Searched a lot in the Django as well as django-pyodbc documentation without any success.
Thanks.
p.s.: Using django-pyodbc and pyodbc drivers
You can create a view:
create view dbo.vw_Users
as
select col1
, col2
, ...
from dbo.Users with (nolock)
And have Django read from the view instead of the table.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With