leapcode / pysqlcipher

Python bindings for SQLCipher
https://leap.se
Other
131 stars 42 forks source link

How to use pysqlcipher with SQLalchemy? #7

Closed dionyziz closed 9 years ago

dionyziz commented 10 years ago

Is it possible to use pysqlcipher with SQLalchemy?

jackwimbish commented 10 years ago

It looks like you can just pass the dbapi2 module to SQLAlchemy when creating your engine:

from pysqlcipher import dbapi2 as sqlite

engine = create_engine('sqlite:///db1.db', module=sqlite)

And it will use pysqlcipher's dbapi2 instead of the default sqlite3/pysqlite2 one

kalikaneko commented 9 years ago

According to the docs, pysqlcipher is supported from version 0.9.9 of sqalchemy: http://docs.sqlalchemy.org/en/rel_0_9/dialects/sqlite.html#module-sqlalchemy.dialects.sqlite.pysqlcipher