Skip to content

Use 2.5's sqlite module as well #293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sqlalchemy-bot opened this issue Sep 2, 2006 · 2 comments
Closed

Use 2.5's sqlite module as well #293

sqlalchemy-bot opened this issue Sep 2, 2006 · 2 comments
Labels
bug Something isn't working sqlite

Comments

@sqlalchemy-bot
Copy link
Collaborator

Migrated issue, originally created by Anonymous

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):
@sqlalchemy-bot
Copy link
Collaborator Author

Michael Bayer (@zzzeek) wrote:

changeset:1844

@sqlalchemy-bot
Copy link
Collaborator Author

Changes by Michael Bayer (@zzzeek):

  • changed status to closed

@sqlalchemy-bot sqlalchemy-bot added sqlite bug Something isn't working labels Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sqlite
Projects
None yet
Development

No branches or pull requests

1 participant