Hi all,
I am using:
with transaction.atomic()
And in the with block, sometimes I use django query like: models.Customer.objects.count()
and sometimes I use cursor, example:
with transaction.atomic():
count_customers = models.Customer.objects.count()
with connection.cursor() as c:
r = c.execute(“SELECT * FROM Customer Inner Join Items ON Customer.Id = Items.FK_Customer")
So my question is, is it necessary to close to use with connection.cursor() ? Do I actually need to close the cursor or it doesn’t matter? What is impact of closing cursor? Does it means the recordset returned gets closed as well?
Will closing the cursor affects the connection? What about executing INSERT and UPDATEs?
Thanks.
Regards,