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, these 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')

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 MIT license.

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.4.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

pythonic_sqlalchemy_query-1.0.4-py2.py3-none-any.whl (10.0 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

File hashes

Hashes for pythonic_sqlalchemy_query-1.0.4.tar.gz
Algorithm Hash digest
SHA256 15552b20f28845d07ac8c380695b0a10e2facb4d998c716f5fac0c78e5b22a25
MD5 7f2eabe5613f621031a71e01339b6a4d
BLAKE2b-256 9ade6d5e335d21120d75b2ba3f3ba5eb49d566dd3c54c5e8ca7b30380175b860

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pythonic_sqlalchemy_query-1.0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5db9d4b179d895728b09c082af0c30dbf4cf4f6548f9a113363df08d9dff83d2
MD5 4777425c79a459769d6b9e555a3abcf4
BLAKE2b-256 f12c58aa2950fe05738778489e266ba67044554871e5e22b2c98bebcce615403

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