Skip to main content

Syntactic sugar for SQLAlchemy: a Storm ORM-like find method

Project description

A find() method for SQLAlchemy

Usage:

from sqlalchemy_find import SessionWithFind, QueryWithFind
from sqlalchemy.orm import sessionmaker

# Configure engine and sessionmaker
engine = create_engine('postgresql://scott:tiger@localhost/')
Session = sessionmaker(bind=engine,
                       class_=SessionWithFind,
                       query_cls=QueryWithFind)

# Create a session
session = Session()

# Equivalent to:
#   query = session.query(MyClass)
#   query = query.filter(MyClass.name == 'foo')
#   query = query.filter_by(is_active=True)
query = session.find(MyClass, MyClass.name == 'foo', is_active=True)

# Equivalent to:
#   ob = session.query(MyClass).get(21)
ob = session.get(MyClass, id=21)

CHANGELOG

Version 0.1

  • Initial release

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-find-0.1.tar.gz (2.4 kB view hashes)

Uploaded Source

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