Drop in replacement for the std libs sqlite3 which enables encryption support for sqlite3
Project description
Pysqleet is a Python wrapper around sqleet. It is a drop in replacement for the standard libraries sqlite3.
Installation
pip install pysqleet
Usage
The usage is the same as sqlite3 with a few differences.
- You can pass the kwarg
key=[bytes, str, None]
tosqleet.connect()
andsqleet.Connection
. - You can call
connection.change_key(key: [bytes, str, None])
to change the key on an already open database. Setting the key to None will decrypt the database, making it compatible with the traditional sqlite3 lib. - A new exception type
sqleet.AuthenticationError(sqleet.DatabaseError)
is exposed, which is raised on authentication based errors.
Example:
import sqleet
key = b"Key"
db_name = "test.sqlite3"
# Create a new encrypted db
con = sqleet.connect(db_name, key=key)
con.execute("create table test(col char);")
con.commit()
con.close()
# Try to open db with the wrong key, this fails
try:
con = sqleet.connect(db_name, key="The wrong key")
except sqleet.AuthenticationError:
print("Failed to open database")
# Remove the encryption on the created database
con = sqleet.connect(db_name, key=key)
con.change_key(None)
con.close()
Versioning
The versions (sqleet.__version__
) first 2 places (major, minor) match the sqleet version used in the sources.
For example an sqleet version of 1.2.3 would have pysqleet version of 12.3. The last place (patch) is used
internally for pysqleet patches.
Sources
Pysqleet mixes source code from the below sources, with any modifications being noted in the copyright header at the beginning of the file.
- CPython v3.6.14 sqlite3 module. ( C Sources (used for ext _sqleet), Python sources (used for sqleet py module) )
- Sqleet v0.31.1 amalgamation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pysqleet-31.1.3.tar.gz
.
File metadata
- Download URL: pysqleet-31.1.3.tar.gz
- Upload date:
- Size: 2.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 941e14b7533eeffcfee666c12e8ecf6e4b72317daafe3d0e788dc8540c8a277a |
|
MD5 | 82b4d6d787a3982e6a9569085afe7c75 |
|
BLAKE2b-256 | c8e4b2271580532bb88e2c42d9f2b386f43e29675fc93269009c26240ebff9dc |
File details
Details for the file pysqleet-31.1.3-cp38-cp38-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: pysqleet-31.1.3-cp38-cp38-macosx_10_14_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.8, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81130581fd94a0a88de10804730a0294883a2fe17edb59a5f8d77e86b3e87e80 |
|
MD5 | 006326dccc340c30d75e8bfad2e345eb |
|
BLAKE2b-256 | 545dae0be5bcf68e03e03d86afa3fd745119e8b30627cb12743b7a609e487736 |