summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Jurczyk <oss@k-jurczyk.de>2016-11-09 20:16:37 +0100
committerKevin Jurczyk <oss@k-jurczyk.de>2016-11-09 20:16:37 +0100
commit3c44420278a9a841b73f8fb61f421edd52de7e16 (patch)
tree4c96eb22d0a50e5d98319af463094fa6d9c19613
parentb141f9f3c8c5c7348daff5aa2a30850c3bf673ba (diff)
downloadsqlalchemy-pr/320.tar.gz
Added support for pysqlcipher3pr/320
-rw-r--r--lib/sqlalchemy/dialects/sqlite/pysqlcipher.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/sqlalchemy/dialects/sqlite/pysqlcipher.py b/lib/sqlalchemy/dialects/sqlite/pysqlcipher.py
index 4a501acac..6dbdb4fa9 100644
--- a/lib/sqlalchemy/dialects/sqlite/pysqlcipher.py
+++ b/lib/sqlalchemy/dialects/sqlite/pysqlcipher.py
@@ -15,6 +15,8 @@
``pysqlcipher`` is a fork of the standard ``pysqlite`` driver to make
use of the `SQLCipher <https://www.zetetic.net/sqlcipher>`_ backend.
+ ``pysqlcipher3`` is a fork of ``pysqlcipher`` for Python 3.
+
.. versionadded:: 0.9.9
Driver
@@ -26,6 +28,9 @@ introduces new PRAGMA commands to SQLite which allows the setting of a
passphrase and other encryption parameters, allowing the database
file to be encrypted.
+`pysqlcipher3` is a fork of `pysqlcipher` with support for Python 3,
+the driver is the same.
+
Connect Strings
---------------
@@ -80,7 +85,13 @@ class SQLiteDialect_pysqlcipher(SQLiteDialect_pysqlite):
@classmethod
def dbapi(cls):
- from pysqlcipher import dbapi2 as sqlcipher
+ try:
+ from pysqlcipher import dbapi2 as sqlcipher
+ except ImportError as e:
+ try:
+ from pysqlcipher3 import dbapi2 as sqlcipher
+ except ImportError:
+ raise e
return sqlcipher
@classmethod