SQLAlchemy query helper
Usage
class User(Base):
id = Column(Integer, primary_key=True)
name = Column(String)
fullname = Column(String)
nickname = Column(String)
timestamp = Column(DateTime)
addresses = relationship("Address")
class Address(Base):
id = Column(Integer, primary_key=True)
title = Column(String)
description = Column(String)
user_id = Column(Integer, ForeignKey("user.id"))
from sqlalchemy_query_helper.query_generator import generate_query
# it will return sql alchemy query object
query=generate_query(session,User,{
"name":{"op":"eq","value":"john"},
"addresses":{"title":{"op":"neq":"value":"new york city"}}
})
# this query is equivalent to below
"""
SELECT user.*,address.* from user
join address on address.user_id=user.id
where user.name='john' and address.title!='new york city'
"""
# notice that it will load joined table if it is in the query.
# There is no select option yet
Available operations
eq(equals)neq(not equals)gt(greater than)gte(greater than equals)lt(less than)lte(less than equals)
More
- Accepts date times as iso format and will convert to python
datetimeautomatically.
Development
-
Install
pipenv -
make install -
Make your changes and open PR
Test
-
Install
sqllite3 -
make test
Metadata
Release files for sqlalchemy-query-helper 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sqlalchemy-query-helper-0.0.5.tar.gz | 3.4 kB | Without provenance | Details for sqlalchemy-query-helper-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sqlalchemy_query_helper-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for sqlalchemy_query_helper-0.0.5-py3-none-any.whl |
Total release size: 7.8 kB
Release files / sqlalchemy-query-helper-0.0.5.tar.gz
| Download URL | sqlalchemy-query-helper-0.0.5.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f700bc3f9e99b9996363b5a64d4c45b2973fed3a64499f08d63371a562cc8a94
|
|
BLAKE2b-256 checksum How to use checksums |
e55127607e0d3d28a3c11a0d9d0d96eff9fa35db7dd9d67db14d8b170f5943e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7
|
Release files / sqlalchemy_query_helper-0.0.5-py3-none-any.whl
| Download URL | sqlalchemy_query_helper-0.0.5-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
315fe85e6251804734dcc08073b22a91e90c94906c84e1d8e41ff9c4cc3de47b
|
|
BLAKE2b-256 checksum How to use checksums |
984567fce8b00b6cf3489166762356e710b69673fb56c0d47e619549f7124a32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7
|
Security for sqlalchemy-query-helper 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.