Close cursor in custom SQL example
It would be better if here in this example, the cursor were explicitly closed (e.g. by using with connection.cursor() as cursor
):
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
Change History
(5)
Triage Stage: |
Unreviewed → Accepted
|
Owner: |
changed from nobody to Chris Jerdonek
|
Status: |
new → assigned
|
Has patch: |
set
|
Triage Stage: |
Accepted → Ready for checkin
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
Is there any advantage to also updating the
PollManager
example in topics/db/managers.txt?