Sqlean.py
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.
Warnings
- breaking Since 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.
- gotcha Starting 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.
- breaking Support for Python 3.6 and 3.7 was removed in version 0.21.8.5. `sqlean.py` now requires Python 3.9 or newer.
Install
-
pip install sqlean.py
Imports
- sqlean
import sqlean
Quickstart
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()