Django

Code

Ticket #882 (closed: fixed)

Opened 3 years ago

Last modified 2 years ago

"django-admin sqlclear" fails with sqlite3

Reported by: ye7cakf02@sneakemail.com Assigned to: adrian
Milestone: Component: Database wrapper
Version: SVN Keywords: sqlite3 unfinalised cursor close
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

$ django-admin sqlclear test
BEGIN;
Traceback (most recent call last):
  File "/home/nisse/bin/django-admin", line 139, in ?
    main()
  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/management.py", line 190, in get_sql_delete
    db.db.close()
  File "/home/nisse/opt/python-2.4.2/lib/python2.4/site-packages/django/core/db/backends/sqlite3.py", line 55, in close
    self.connection.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 http://lists.initd.org/pipermail/pysqlite/2005-August/000129.html the problem appears when you're closing your database connection without first closing your cursor. Thus, a simple fix is to add the line:

   cursor.close()

To the file management.py 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.

Attachments

Change History

11/24/05 22:27:51 changed by adrian

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #882 ("django-admin sqlclear" fails with sqlite3)




Change Properties
Action