Skip to main content

making SQLAlchemy great again

Project description

SQLAlchemy Lightening

Making SQLAlchemy great again

Install

pip install sqlalchemy_lightening

Usage

# load by id
Person.get(1)

# load multiple by id
Person.get([1, 2, 3])

# basic filter
Person.where(name='dpepper')

# where `name` in ...
Person.where(name=['dpepper', 'thatguy'])

# mix and match
Person.where(Person.id != 1, name='dpepper')

# standard utilities
Person.all
Person.first

# standard SQLAlchemy query
Person.query

Example Setup

from sqlalchemy import Column, Integer, String, create_engine
from sqlalchemy.orm import declarative_base, sessionmaker
from sqlalchemy_lightening import LighteningBase


# create base sqlalchemy model
Base = declarative_base()

# extend LighteningBase mixin
class Person(LighteningBase, Base):
    id = Column(Integer, primary_key=True)
    name = Column(String(250))

engine = create_engine('sqlite:///:memory:')
session = sessionmaker(bind=engine)()

Base.metadata.create_all(engine)

# wire things up
LighteningBase.query_class = session.query

# good to go
Person.winning

installs

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

sqlalchemy_lightening-0.7.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqlalchemy_lightening-0.7.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file sqlalchemy_lightening-0.7.0.tar.gz.

File metadata

  • Download URL: sqlalchemy_lightening-0.7.0.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sqlalchemy_lightening-0.7.0.tar.gz
Algorithm Hash digest
SHA256 a66b46c0aac17cf149e1c7764dddb9ac655b913efbed990d0474b6e3bbfb9300
MD5 5db97b6a8a4c67f9482eb7a3f880768c
BLAKE2b-256 6f153ad77e6352ed51e161a109836c44b62cf963782e4236636c6a701110723e

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqlalchemy_lightening-0.7.0.tar.gz:

Publisher: python.yml on dpep/py_sqlalchemy_lightening

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sqlalchemy_lightening-0.7.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sqlalchemy_lightening-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d785427330fa993531f0d956558cb9d3f7e08e83185ad9a6817ca23c5e92c5d
MD5 906179f5063b4d598a17ae972fbffc72
BLAKE2b-256 4fc18c21a9325d68a3a3ae066bab0af67e670486119e4519c76824e6e8b497cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqlalchemy_lightening-0.7.0-py3-none-any.whl:

Publisher: python.yml on dpep/py_sqlalchemy_lightening

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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