Opened 9 years ago

Closed 9 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, 9 years ago

Owner: changed from nobody to Philip Liberato
Status: newassigned

comment:2 by Philip Liberato, 9 years ago

Resolution: fixed
Status: assignedclosed

comment:3 by Markus Holtermann, 9 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, 9 years ago

Sorry. Here's a link to the branch:

https://github.com/pnl8zp/django/tree/ticket_26613

Version 0, edited 9 years ago by Philip Liberato (next)

comment:5 by Tim Graham, 9 years ago

Has patch: set
Triage Stage: UnreviewedAccepted

comment:6 by Tim Graham <timograham@…>, 9 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