Registry / database / sqlean.py

sqlean.py

JSON →
library3.50.4.5pypypi✓ verified 29d ago

Sqlean.py bundles SQLite with a collection of useful extensions (e.g., crypto, fuzzy, ipaddr, math, stats, text, uuid). It provides a drop-in replacement for the built-in `sqlite3` module, offering enhanced functionality. The current version is 3.50.4.5, and it closely follows SQLite's release cycle for major versions, integrating Sqlean extensions.

pip install sqlean.py
INSTALL
IMPORT
SIG · SQLEAN.PY
S
sqlean.py
databasepythonv3.50.4.5
Install
1.6s avg
Import
10ms
Disk
24MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v3.50.4.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✓ 1.6s
py 3.11
✕ build_error
✓ 1.7s
py 3.12
✕ build_error
✓ 1.5s
py 3.13
✕ build_error
✓ 1.6s
py 3.9
✕ build_error
✕ build_error
24MB installed
● package 24MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sqlean
✓ import sqlean

Demonstrates connecting to an in-memory database, enabling all Sqlean extensions, and executing a query that uses an extension function (median).

import sqlean # Enable all Sqlean extensions. This must be called before connect(). sqlean.extensions.enable_all() conn = sqlean.connect(":memory:") cur = conn.execute("select median(value) from generate_series(1, 99)") result = cur.fetchone() print(f"Median: {result[0]}") conn.close()
Debug
Known issues
breakingSince version 0.21.5.1, all Sqlean extensions are disabled by default. Simply importing `sqlean` will behave like the standard `sqlite3` module without additional functionality.
fix
Call `sqlean.extensions.enable_all()` before `sqlean.connect()` to enable all extensions, or `sqlean.extensions.enable(name)` for specific ones.
affects: >=0.21.5.1
gotchaStarting with version 3.45.0, `sqlean.py`'s major version now aligns with the underlying SQLite library version (e.g., 3.45.0 for SQLite 3.45.0), rather than its own internal versioning scheme.
fix
Be aware that version updates primarily reflect SQLite updates. Check the release notes for the integrated Sqlean extension version.
affects: >=3.45.0
breakingSupport for Python 3.6 and 3.7 was removed in version 0.21.8.5. `sqlean.py` now requires Python 3.9 or newer.
fix
Upgrade your Python environment to version 3.9 or a newer compatible version.
affects: >=0.21.8.5
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'sqlean'
The `sqlean.py` package is not installed in the current Python environment.
fix
Run `pip install sqlean.py` in your terminal to install the package.
sqlite3.OperationalError: no such function: hex
The `sqlean.py` library was installed, but the code is either importing the standard `sqlite3` module directly, or `import sqlean` was not called to patch `sqlite3` before the database connection was established.
fix
Replace `import sqlite3` with `import sqlean` and use `sqlean.connect()` to ensure the enhanced SQLite module with Sqlean extensions is used.
AttributeError: module 'sqlean' has no attribute 'fuzzy'
Sqlean extensions provide SQL functions that are callable within SQL queries executed on a database connection, not directly as Python functions from the `sqlean` module.
fix
Connect to the database using `sqlean.connect()` and execute the function as part of a SQL query. For example, `conn.execute("SELECT jaro_winkler('apple', 'aple');")`.
sqlite3.OperationalError: text_similarity: wrong number of arguments: expected 2, got 1
An Sqlean extension function was called within a SQL query with an incorrect number of arguments.
fix
Consult the Sqlean documentation or reference the expected arguments for the specific function and provide them correctly in the SQL query. For `text_similarity`, two arguments are typically required, like `conn.execute("SELECT text_similarity('hello world', 'world hello');")`.
Upgrade
Version history
3.50.4.5latest on PyPI · released Oct 25, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
10
OpenAI (training)
1
Resources
sqlean.py — pip install sqlean.py · libregistry