From time to time, I\'m executing raw queries using connection.cursor() instead of using ORM (since it is definitely not a silver bullet).
I\'ve noticed that in seve
I'm a bit late to this question. Maybe a close-on-exit-scope is what you want.
from contextlib import closing from django.db import connection with closing(connection.cursor()) as cursor: cursor.execute(...) cursor.execute(...) cursor.execute(...)