sqlite3 with extensions
Project description
sqlean.py
This package provides an SQLite Python wrapper bundled with sqlean
extensions. It's a drop-in replacement for the standard library's sqlite3
module.
pip install sqlean.py
import sqlean
# enable all extensions
sqlean.extensions.enable_all()
# has the same API as the default `sqlite3` module
conn = sqlean.connect(":memory:")
conn.execute("create table employees(id, name)")
# and comes with the `sqlean` extensions
cur = conn.execute("select median(value) from generate_series(1, 99)")
print(cur.fetchone())
# (50.0,)
conn.close()
Extensions
sqlean.py
contains 12 essential SQLite extensions:
- crypto: Hashing, encoding and decoding data
- define: User-defined functions and dynamic SQL
- fileio: Reading and writing files
- fuzzy: Fuzzy string matching and phonetics
- ipaddr: IP address manipulation
- math: Math functions
- regexp: Regular expressions
- stats: Math statistics
- text: String functions
- unicode: Unicode support
- uuid: Universally Unique IDentifiers
- vsv: CSV files as virtual tables
Installation
A binary package (wheel) is available for the following operating systems:
- Windows (64-bit)
- Linux (64-bit)
- macOS (both Intel and Apple processors)
pip install sqlean.py
Note that the package name is sqlean.py
, while the code imports are just sqlean
. The sqlean
package name was taken by some zomby project and the author seemed to be unavailable, so I had to add the .py
suffix.
Usage
All extensions are disabled by default. You can still use sqlean
as a drop-in replacement for sqlite3
:
import sqlean as sqlite3
conn = sqlite3.connect(":memory:")
cur = conn.execute("select 'sql is awesome'")
print(cur.fetchone())
conn.close()
To enable all extensions, call sqlean.extensions.enable_all()
before calling connect()
:
import sqlean
sqlean.extensions.enable_all()
conn = sqlean.connect(":memory:")
cur = conn.execute("select median(value) from generate_series(1, 99)")
print(cur.fetchone())
conn.close()
To enable specific extensions, call sqlean.extensions.enable()
:
import sqlean
sqlean.extensions.enable("stats", "text")
conn = sqlean.connect(":memory:")
cur = conn.execute("select median(value) from generate_series(1, 99)")
print(cur.fetchone())
conn.close()
Building from source
For development purposes only.
Prepare source files:
make prepare-src
make download-sqlite
make download-sqlean
Build and test the package:
make clean
python setup.py build_ext -i
python -m test
python -m pip wheel . -w dist
Credits
Based on the pysqlite3 project. Available under the Zlib license.
Stay tuned
Follow @ohmypy on Twitter to keep up with new features 🚀
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 Distributions
Built Distributions
Hashes for sqlean.py-0.21.5.1-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fdbad8fd4962e7ef3cc71ea4e020f09d8b5382771358aa0a640f102d9161138 |
|
MD5 | 036c0791f04733c540c0e8619e027645 |
|
BLAKE2b-256 | 067eadedd5e049090f5eb384c76f41fc9129915bf4257d67cd603f4e8d2bf4ae |
Hashes for sqlean.py-0.21.5.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 037884d4a414f43d2e688c8273196757c4d7e398b47d2fec103084101d545843 |
|
MD5 | 77570776d7db63ebc1c343b0050992a8 |
|
BLAKE2b-256 | 6bc7b4027178560f18176d2dc668dd94e3b2dc47a34a4fa943acb2ddb05bca4c |
Hashes for sqlean.py-0.21.5.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54b1276a38ada671ab2c2f40b10a04c4447797864467577967131f5c6b9f6751 |
|
MD5 | ea5306722ecf6c2dfce034dec36c35a9 |
|
BLAKE2b-256 | 3533caaba9f97a5a1ef6cd86447e1567f803c4c2d02a91db656abf48f3ab1f01 |
Hashes for sqlean.py-0.21.5.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90c9841c943937ff181d2916d8e0494fe1d64fb0564df5901294acc9ab4235fb |
|
MD5 | b4cff22d749ab5690bbbf9056d4b08bd |
|
BLAKE2b-256 | b912010ca7fb80eb7a94dcee6876cce03b1900b877eb0a0f26118b701660be32 |
Hashes for sqlean.py-0.21.5.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9ed0de84d627147ba25d97fe068474dbf42975df4ff7aed04ca5240dfd843f0 |
|
MD5 | 4437ba1ca3a7c00e3671a1020d1da7eb |
|
BLAKE2b-256 | 4b23a964f6fe5f88e361fd7d8da93baeb05cb69f9e03272845d1a3bff48c105e |
Hashes for sqlean.py-0.21.5.1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be7130f33448724f1f288f8697a47121f8523725ce234f8ef3a72affe330e795 |
|
MD5 | f36b40ff41b5bc2abd6372ea8b520843 |
|
BLAKE2b-256 | e56db21ed6d0174f82f4990ec142bf1fdf21c4e5347356993a079f33d6221a51 |
Hashes for sqlean.py-0.21.5.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3a1c0d08d519395ab2f5916f0b237cd48fca45b1fe472e8a2028914e686f33f |
|
MD5 | b3689e89f1623de0146f093b5112851d |
|
BLAKE2b-256 | 13eb652f5bead98da55bba78a7c7c21a5a7bdb042f0417d1d3316cc5bcebb3f8 |
Hashes for sqlean.py-0.21.5.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08795c9561e96a4e51d2fe3b5831820c30e99f02ff77075af2ff52b7f0953218 |
|
MD5 | 3890c3ef8dddce2893dd5cc451e7d681 |
|
BLAKE2b-256 | f9ccc01591c0adc7916e7ee9f9f26fbd22e7b79f2b018502a9525d94db365f6b |
Hashes for sqlean.py-0.21.5.1-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ea26ee191647e4b86f769d034368629e2df67db8c61cb5d39bcceba2998bf02 |
|
MD5 | 78c5e1b80ef5396d59c12cf76a72c8b1 |
|
BLAKE2b-256 | 3727cd3770cd3a7a8bee6aa0ea7f9e3de55f21da7cb02e769c0d4db49460038c |
Hashes for sqlean.py-0.21.5.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea6f7a6f6a83896ab76ab81140c58619dbabb7a71e7567e2e533d5378ee90be9 |
|
MD5 | 72f0e638afafc2be14ea16829392c5f9 |
|
BLAKE2b-256 | 657468ec56123afc6a370ff9a768a126fdbc6f11c07597af6cf64475eadc73f5 |
Hashes for sqlean.py-0.21.5.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7e98c8fcfdee48808f4d4538aef65a1a48f2e4c0f842e6a46503720130150c0 |
|
MD5 | 64db982e9b1c3d6677ee2e02d7128f0c |
|
BLAKE2b-256 | 978d1bf71193457ddd9f00a0fc2650c9c8566c203bf42b803f8675f2c007f52e |
Hashes for sqlean.py-0.21.5.1-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 954bca7c722b0e1f28e39fbb69f94b0049e8d255daf728d03f42e6e15e1b135a |
|
MD5 | 5395839e39e0494d94c20bb368566abd |
|
BLAKE2b-256 | 9ed4fe8c352f3301663ceabb56ae4d315f3376810eaba80ee03488d3cf42b5d4 |
Hashes for sqlean.py-0.21.5.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20907f40637e0ceb0844c4cbca7dcafac580e621ef033e651c9def0f2dcafd46 |
|
MD5 | a71559c2fc4235613ef105196556f2d8 |
|
BLAKE2b-256 | 1ff16587f474bd32845eeea7ef696cf114fb3b0f6ed2a4c538f76a13e78a245a |
Hashes for sqlean.py-0.21.5.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd0c80321e0fb0adbb74a4239df6640250b506a072d97dbe9d53eeb2a2a1b6e7 |
|
MD5 | 47e89eca52248510c463b17b36772de9 |
|
BLAKE2b-256 | a2606505931759be5387ebbe962d16d28e87358b1ed902706a49e7d28fb27fd8 |
Hashes for sqlean.py-0.21.5.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8900954de469ae1876c5ee8e63b3bbd9a4e0e9e29a019daa2aac2f69fd3b2eea |
|
MD5 | 23680f615c555bad95f285a3d2351fe2 |
|
BLAKE2b-256 | 3a7ab424191abd40046671ea99e726f9ac10feee8cca4b5d314a2ad6af20bebc |
Hashes for sqlean.py-0.21.5.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f7f597ba102e56cd36192be5d7eacfe5495352e02c056afef51bb9f3caa81f8 |
|
MD5 | ac85463ffe4f00c8efd5653cfaeccc66 |
|
BLAKE2b-256 | 15156158893031490a25a2cb98a2b504a354f04ee56e1a946285fa5bbc534607 |