Fix a premature import when patching SQLite compatibility.
Review Request #12414 — Created June 24, 2022 and submitted
We provide a compatibility patch that fixes certain versions of SQLite
with Django prior to 2.1.5.
This patch made the assumption that it could import the Django SQLite
backend at the module level, since SQLite is built into Python. However,
on modern versions of Django, this will fail to import if the version of
SQLite is too old.
We now import this only if we're about to apply the patch, in which case
we've already confirmed the compatible version range.
Tested on reviews.reviewboard.org, where this problem was first encountered
due to an older SQLite. We no longer hit a premature import.