Skip to main content

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

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 details)

Uploaded Source

File details

Details for the file sqlalchemy-find-0.1.tar.gz.

File metadata

  • Download URL: sqlalchemy-find-0.1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for sqlalchemy-find-0.1.tar.gz
Algorithm Hash digest
SHA256 eccfbf3398c158fe8ba568688b2cced6fe56cfd78f38a63cb410c8fa9ab6f831
MD5 653c53b40501b44bf1b4d85b688a7a38
BLAKE2b-256 9f136a3a9b7a92139c37b8b396435d76d7d6c6d8f797220ffea8682fccb59315

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1 This release

1 file

0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page