Opened 8 years ago

Closed 8 years ago

#26613 closed Bug (fixed)

SQLite3 DB backend should remove dependency on sqlite3 module

Reported by: Gatzy118 Owned by: Philip Liberato
Component: Database layer (models, ORM) Version: 1.9
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Given Django tries to use pysqlite2 by default anyway, would it be reasonably to change in django.db.backends.sqlite3.schema this:

   35     def quote_value(self, value):
   36         # The backend "mostly works" without this function and there are use
   37         # cases for compiling Python without the sqlite3 libraries (e.g.
   38         # security hardening).
   39         import sqlite3
   40         try:
   41             value = sqlite3.adapt(value)
   42         except sqlite3.ProgrammingError:
   43             pass
   44         # Manual emulation of SQLite parameter quoting
   45         if isinstance(value, type(True)):
...

Into this:

 41         try:
 42             import sqlite3
 43             value = sqlite3.adapt(value)
 44         except ImportError:
 45             pass
 46         except sqlite3.ProgrammingError:
 47             pass
 48         # Manual emulation of SQLite parameter quoting
 49         if isinstance(value, type(True)):
...

Change History (6)

comment:1 by Philip Liberato, 8 years ago

Owner: changed from nobody to Philip Liberato
Status: newassigned

comment:2 by Philip Liberato, 8 years ago

Resolution: fixed
Status: assignedclosed

comment:3 by Markus Holtermann, 8 years ago

Resolution: fixed
Status: closednew

Please don't mark a ticket as fixed until the respective patch has been committed. Thank you.

comment:4 by Philip Liberato, 8 years ago

Sorry. Here's a link to the PR.

Last edited 8 years ago by Tim Graham (previous) (diff)

comment:5 by Tim Graham, 8 years ago

Has patch: set
Triage Stage: UnreviewedAccepted

comment:6 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: newclosed

In 3630b49:

Fixed #26613 -- Made sqlite3 optional in SchemaEditor.quote_value().

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