Skip to main content

making SQLAlchemy great again

Project description

SQLAlchemy Lightening

Making SQLAlchemy great again


pip install sqlalchemy_ligthening


# load by id

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

# basic filter

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

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

# standard utilities

# standard SQLAlchemy query

Example Setup

from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import 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.bind = engine

# wire things up
LighteningBase.query_class = session.query

# good to go


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for sqlalchemy-lightening, version 0.5.0
Filename, size File type Python version Upload date Hashes
Filename, size sqlalchemy_lightening-0.5.0-py3-none-any.whl (7.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size sqlalchemy_lightening-0.5.0.tar.gz (7.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page