﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
27172	Close cursor in custom SQL example	Chris Jerdonek	Chris Jerdonek	"It would be better if [https://docs.djangoproject.com/en/dev/topics/db/sql/#executing-custom-sql-directly here] in this example, the cursor were explicitly closed (e.g. by using `with connection.cursor() as cursor`):
{{{#!python
def my_custom_sql(self):
    cursor = connection.cursor()

    cursor.execute(""UPDATE bar SET foo = 1 WHERE baz = %s"", [self.baz])

    cursor.execute(""SELECT foo FROM bar WHERE baz = %s"", [self.baz])
    row = cursor.fetchone()

    return row
}}}"	Cleanup/optimization	closed	Documentation	dev	Normal	fixed			Ready for checkin	1	0	0	0	0	0
