Use 2.5's sqlite module as well

Issue #293 resolved
Former user created an issue

SQLAlchemy currently doesn't fall back on 2.5's sqlite3 module, which is just sqlite with a different name. This is arguably either a defect or an enhancement, but it's a simple fix either way. The below patch (in {{{diff -u}}} format) on databases/sqlite.py at r1815 fixes this.

--- sqlite-r1815.py 2006-09-02 17:19:40.777387600 +0100
+++ sqlite-mod.py   2006-09-02 17:27:39.706053200 +0100
@@ -16,11 +16,14 @@

 try:
     from pysqlite2 import dbapi2 as sqlite
-except:
+except ImportError:
     try:
-        sqlite = __import__('sqlite') # skip ourselves
-    except:
-        sqlite = None
+        from sqlite3 import dbapi2 as sqlite #try the 2.5+ stdlib name.
+    except ImportError:
+        try:
+            sqlite = __import__('sqlite') # skip ourselves
+        except:
+            sqlite = None

 class SLNumeric(sqltypes.Numeric):
     def get_col_spec(self):

Comments (1)

  1. Log in to comment