Giter Club home page Giter Club logo

sqlalchemy-sqlean's Introduction

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

sqlalchemy-sqlean's People

Contributors

dependabot[bot] avatar edgarrmondragon avatar pre-commit-ci[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar

sqlalchemy-sqlean's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.