SQLAlchemy dialect for the sqlean.py SQLite wrapper
Project description
sqlean-driver
A SQLAlchemy driver for sqlean.py
.
Table of Contents
Installation
pip install sqlean-driver
Usage
from sqlalchemy import create_engine, text
engine = create_engine("sqlite+sqlean:///:memory:?extensions=all")
with engine.connect() as conn:
result = conn.execute(text("SELECT ipfamily('192.168.1.1')"))
print(result.scalar()) # 4
Extensions
By default, sqlean.py
disables all SQLite extensions. To enable all of them, pass extensions=all
as a query parameter to the connection string. Or use a comma-separated list of extensions to enable only some of them, e.g. extensions=ipaddr,crypto
.
Alternatives
Note that you don't strictly need this driver to use sqlean.py
. You can supply sqlean
as the module
parameter:
import sqlean
from sqlalchemy import create_engine, text
sqlean.extensions.enable_all()
engine = create_engine("sqlite:///:memory:", module=sqlean)
with engine.connect() as conn:
result = conn.execute(text("SELECT ipfamily('192.168.1.1')"))
print(result.scalar()) # 4
Development
This project uses Hatch to manage the development environment, so make sure you have it installed.
Run tests and coverage
hatch run cov
Run linter
hatch run lint:style
License
sqlean-driver
is distributed under the terms of the MIT license.
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
sqlean_driver-0.0.1a2.tar.gz
(7.1 kB
view hashes)
Built Distribution
Close
Hashes for sqlean_driver-0.0.1a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89682efa20f600b1da91af76871453ca94a7d938c6f537112c7c34851f3b2fec |
|
MD5 | f21083078f4ae71ec88980dda9375615 |
|
BLAKE2b-256 | a4cafa0ebd2b8aa1066e2c82808b01059df30f89fb27ae28fe7979f6e623b828 |