Skip to content

NeoSahadeo/pysqlcipher

Repository files navigation

Python Bindings for SQL Cipher

Provided methods

  • open - connect to a db
  • execute - execute a sql commmand
  • close - close a connection to a db

Usage

# Import using `sqlcipher`
import sqlcipher

# SQLiteDB takes in the name and key of the database
db = sqlcipher.open("test.db", "test1234")

# Execute will run an SQL command
print(db.execute("SELECT * FROM movies;"))

# Close the database connection
db.close()

It has support for SQL parameterized strings

db.execute("INSERT INTO users (username, password) VALUES (?, ?)", ("Emily", "1Password"))

Installing

Wheels only exist for Linux x86-64.

pip install git+https://github.com/NeoSahadeo/pysqlcipher.git

For a Windows build, please send a PR. You will have to compile it yourself, read the github workflow to see the general steps.

Compiling

Linux Bash

git clone --depth=1 https://github.com/NeoSahadeo/pysqlcipher
cd pysqlcipher
git clone --depth=1 https://github.com/sqlcipher/sqlcipher
cd sqlcipher
./configure --with-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_EXTRA_INIT=sqlcipher_extra_init -DSQLITE_EXTRA_SHUTDOWN=sqlcipher_extra_shutdown" \
	LDFLAGS="-lcrypto"
make sqlite3.o
cd ..
make gen_so

Contributing

Contributions welcome. Currently in need of a python package for pip.

LICENSE(S)

For all binaries and sources that belong to ZETETIC LLC and that are used in bindings belong to and have the respected copyright of BSD 3-Clause License.

My source files are licensed under MIT

About

Python bindings for SQL Cipher

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published