try to fallback to pysqlite2.dbapi2 as sqlite3 in core.history #2718

Merged
merged 1 commit into from Jan 20, 2013

2 participants

@skyl

for situations where Python is built without sqlite3 and
can not easily be changed, it would be nice to still be
able to get history with pysqlite2.

@skyl skyl try to fallback to pysqlite2.dbapi2 as sqlite3
for situations where Python is built without sqlite3 and
can not easily be changed, it would be nice to still be
able to get history with pysqlite2.
09c5f96
@Carreau Carreau commented on the diff Dec 24, 2012
IPython/core/history.py
@@ -20,7 +20,10 @@
try:
import sqlite3
except ImportError:
- sqlite3 = None
+ try:
+ from pysqlite2 import dbapi2 as sqlite3
@Carreau
IPython member
Carreau added a line comment Dec 24, 2012

Do we have guaranties that the api will be the same ?

I don't like importing as sqlite3 as later you don't know that sqlite3 is not effectively sqlite3

Maybe importing both as history_db and change sqlite3 references across all file ?

@takluyver
IPython member
takluyver added a line comment Dec 24, 2012
@minrk
IPython member
minrk added a line comment Jan 18, 2013

I disabled sqlite3 and ran iptest, and played around interactively, and this seems to work just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Carreau
IPython member

Merging as this seem to be ok.

@Carreau Carreau merged commit 42886e3 into ipython:master Jan 20, 2013

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment