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, func, select
engine = create_engine("sqlite+sqlean:///:memory:?extensions=all")
with engine.connect() as conn:
result = conn.execute(select(func.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
with SQLAlchemy. You can supply sqlean
as the module
parameter to create_engine
:
import sqlean
from sqlalchemy import create_engine, func, select
sqlean.extensions.enable_all()
engine = create_engine("sqlite:///:memory:", module=sqlean)
with engine.connect() as conn:
result = conn.execute(select(func.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
Run tests and compute coverage for all supported Python and SQLAlchemy versions:
hatch run test:cov
Combine coverage output into a single report:
hatch run coverage:report
Run linter
hatch run lint:style
Run type checker
hatch run typing:check
License
sqlean-driver
is distributed under the terms of the MIT license.
Acknowledgements
- Anton Zhiyanov for creating
sqlean
andsqlean.py
. - Orhun Parmaksız for creating
git-cliff
, which this project uses to keep a changelog.
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 sqlean_driver-0.2.0.tar.gz
.
File metadata
- Download URL: sqlean_driver-0.2.0.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e85d5070bd0469bce14a9dd2e501a097b067df927b0fb91ca15211af7279709a |
|
MD5 | 123f1159fc15c0b178c17fc61b7ec755 |
|
BLAKE2b-256 | e2fc222ba4dbbb1ca21263d7f2100e7befdd15a7aab3bf9d1ba00d6941c08af3 |
File details
Details for the file sqlean_driver-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: sqlean_driver-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d4467404f8525ab53285f98d7aa462afa05e9786b6897fb005cf979314b5d3b |
|
MD5 | 705a28cfaa26f90b97c6f8d1a4a9bc82 |
|
BLAKE2b-256 | 802f67dca21580e3b6009af61ce33c47dc7b81550bf8bb8c4c84d9500ec94b6e |