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 session.User['jack'].addresses:
# Do some processing on result...
The examples provide full, working code.
Use with Flask-SQLAlchemy
For most cases:
from pythonic_sqlalchemy_query.flask import SQLAlchemyPythonicQuery
app = Flask(__name__)
db = SQLAlchemyPythonicQuery(app)
# After defining some declarative classes, query away:
for result in User['jack'].addresses:
# Do some processing on result...
The examples provide full, working code.
Documentation
See the pythonic_sqlalchemy_query module.
License
This software is distributed under the terms of the MIT license.
Release files for pythonic-sqlalchemy-query 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pythonic_sqlalchemy_query-1.2.0.tar.gz | 9.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pythonic_sqlalchemy_query-1.2.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size:27.9 kB
Release files / pythonic_sqlalchemy_query-1.2.0.tar.gz
| Download URL | pythonic_sqlalchemy_query-1.2.0.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6eab85d7f640291a980cc00ee8cdd8aa12dc65b830969a1b684eb2583f475b48
|
|
BLAKE2b-256 checksum How to use checksums |
5450103d56209e89a63e57039a9d5365cec8da74c8b73443c13c5e5d846b3055
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pythonic_sqlalchemy_query-1.2.0-py2.py3-none-any.whl
| Download URL | pythonic_sqlalchemy_query-1.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 18.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
cf66f682cc3a5aefbad4a64fc81c4232cc5878c65c198c0f53f417e1f0748df7
|
|
BLAKE2b-256 checksum How to use checksums |
156cc41559ed69b91013aec86bf5b5b8d64a9c1e7aa09c8703bc76d5cfd2e119
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |