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

Merged
merged 1 commit into from Jan 20, 2013

Conversation

Projects
None yet
4 participants
Contributor

skyl commented Dec 24, 2012

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.

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.
@@ -20,7 +20,10 @@
try:
import sqlite3
except ImportError:
- sqlite3 = None
+ try:
+ from pysqlite2 import dbapi2 as sqlite3
@Carreau

Carreau Dec 24, 2012

Owner

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

takluyver Dec 24, 2012

Owner

The database API is supposed to be consistent, so I think importing as
sqlite3 is OK. Changing the name across the file would make the code harder
to read, and leaves more chances for bugs to sneak in.

Skylar, have you tested it with pysqlite2, both manually and by running
iptest?

On 24 December 2012 11:46, Bussonnier Matthias notifications@github.comwrote:

In IPython/core/history.py:

@@ -20,7 +20,10 @@
try:
import sqlite3
except ImportError:

  • sqlite3 = None
  • try:
  •    from pysqlite2 import dbapi2 as sqlite3
    

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 ?


Reply to this email directly or view it on GitHubhttps://github.com/ipython/ipython/pull/2718/files#r2497725.

@minrk

minrk Jan 18, 2013

Owner

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

Owner

Carreau commented Jan 20, 2013

Merging as this seem to be ok.

Carreau added a commit that referenced this pull request Jan 20, 2013

Merge pull request #2718 from skyl/patch-1
try to fallback to pysqlite2.dbapi2 as sqlite3 in core.history

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

1 check passed

default The Travis build passed
Details

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014

Merge pull request #2718 from skyl/patch-1
try to fallback to pysqlite2.dbapi2 as sqlite3 in core.history
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment