Skip to main content

SQLAlchemy dialect for the sqlean.py SQLite wrapper

Project description

sqlean-driver

PyPI - Version PyPI - Python Version

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

Project details


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.2.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

sqlean_driver-0.2.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

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

Hashes for sqlean_driver-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e85d5070bd0469bce14a9dd2e501a097b067df927b0fb91ca15211af7279709a
MD5 123f1159fc15c0b178c17fc61b7ec755
BLAKE2b-256 e2fc222ba4dbbb1ca21263d7f2100e7befdd15a7aab3bf9d1ba00d6941c08af3

See more details on using hashes here.

File details

Details for the file sqlean_driver-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sqlean_driver-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7d4467404f8525ab53285f98d7aa462afa05e9786b6897fb005cf979314b5d3b
MD5 705a28cfaa26f90b97c6f8d1a4a9bc82
BLAKE2b-256 802f67dca21580e3b6009af61ce33c47dc7b81550bf8bb8c4c84d9500ec94b6e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page