Skip to main content

Provide concise, Pythonic query syntax for SQLAlchemy

Project description

The pythonic_sqlalchemy_query module provides concise, Pythonic query syntax for SQLAlchemy. For example, the two queries produce identical results:

pythonic_query = session.User['jack'].addresses['jack@google.com']
traditional_query = (
    # Ask for the Address...
    session.query(Address).
    # by querying a User named 'jack'...
    select_from(User).filter(User.name == 'jack').
    # then joining this to the Address 'jack@google.com`.
    join(Address).filter(Address.email_address == 'jack@google.com')

See the module documentation for more information.

Installation

pip install pythonic_sqlalchemy_query

Use with SQLAlchemy

For most cases:

from pythonic_sqlalchemy_query import QueryMakerSession

# Construct an engine as usual.
engine = create_engine(...)
# Create a session aware of this module.
Session = sessionmaker(bind=engine, class_=QueryMakerSession)
session = Session()

# After defining some declarative classes, query away:
for result in User['jack'].addresses:
    # Do some processing on result...

The example provides full, working code.

Documentation

See the pythonic_sqlalchemy_query module.

License

This software is distributed under the terms of the GNU public license, version 3.

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

pythonic_sqlalchemy_query-1.0.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

pythonic_sqlalchemy_query-1.0.0-py2.py3-none-any.whl (8.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pythonic_sqlalchemy_query-1.0.0.tar.gz.

File metadata

File hashes

Hashes for pythonic_sqlalchemy_query-1.0.0.tar.gz
Algorithm Hash digest
SHA256 88b7fc99a5cd1aa3bbf660ede52cda5a0e5b87069014f242313c6d341693d9a2
MD5 fa16721698bf0c4085c3d3fd0d4862fd
BLAKE2b-256 fdf4e3eb49bcd3adba8c563a73aeac00ab9be8684bb63415215e67aa51fc3599

See more details on using hashes here.

File details

Details for the file pythonic_sqlalchemy_query-1.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pythonic_sqlalchemy_query-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 cff316eeba94e34e5c3c8bd9be1ee65c122b442e57f8516bf493e5554c16f576
MD5 f93cdd6e06066a76561d0377110745a6
BLAKE2b-256 8aed779a5a762e23f890fc77c858002e78d72cdae79af0dda4ad526868e2ada2

See more details on using hashes here.

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