Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#882 closed defect (fixed)

"django-admin sqlclear" fails with sqlite3

Reported by: ye7cakf02@… Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version: master
Severity: major Keywords: sqlite3 unfinalised cursor close
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


$ django-admin sqlclear test
Traceback (most recent call last):
  File "/home/nisse/bin/django-admin", line 139, in ?
  File "/home/nisse/bin/django-admin", line 132, in main
    output = ACTION_MAPPING[action](mod)
  File "/home/nisse/opt/python-2.4.2/lib/python2.4/site-packages/django/core/", line 190, in get_sql_delete
  File "/home/nisse/opt/python-2.4.2/lib/python2.4/site-packages/django/core/db/backends/", line 55, in close
pysqlite2.dbapi2.OperationalError: Unable to close due to unfinalised statements

This is with the latest SVN django and pysqlite-2.0.5.
According to the problem appears when you're closing your database connection without first closing your cursor. Thus, a simple fix is to add the line:


To the file on the line before the one that triggers the exception (see traceback).
This probably won't fix all the cases but it sure solves my problem.

Change History (1)

comment:1 Changed 13 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

(In [1429]) Fixed #882 -- Fixed bug when doing sqlclear with SQLite. Thanks, ye7cakf02

Note: See TracTickets for help on using tickets.
Back to Top