sqlalchemy-builder
Build SQLAlchemy statements avoiding common footguns.
Example
Build select statements functionally using | and |=
select(Model).where(Model.id == 1)
Becomes:
from sqlalchemy_builder.select import where
select(Model) | where(Model.id == 1)
|= is also supported:
statement = select(Model)
if value:
statement |= where(Model.value == value)
Why?
There is a common mistake when building sqlalchemy statements.
statement = select(Model)
if status is not None:
statement.where(Model.status == status)
The statement.where does not do anything as it generates a new Select object.
To fix this we have to assign it:
statement = statement.where(...)
This can be a bit verbose though not the worst issue. By using implace |= we can avoid this issue without making the statement mutable.
It's also just a fun syntax to play with.
Development
Installing dependencies:
$ uv sync
Running tests:
$ uv run pytest
Metadata
Release files for sqlalchemy-builder 0.1.1
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_builder-0.1.1.tar.gz | 37.0 kB | With provenance | Details for sqlalchemy_builder-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sqlalchemy_builder-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for sqlalchemy_builder-0.1.1-py3-none-any.whl |
Total release size: 49.3 kB
Release files / sqlalchemy_builder-0.1.1.tar.gz
| Download URL | sqlalchemy_builder-0.1.1.tar.gz |
|---|---|
| Size | 37.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f74c583f7f4389dd1ff1d3ff56247f7b3805007d01eadf6806e9f8f93a51417a
|
|
BLAKE2b-256 checksum How to use checksums |
fa7343609c0db47db15393786b039a28353d44bc77418a88c5f349be83a0210e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 3, 2025.
Transparency logRelease files / sqlalchemy_builder-0.1.1-py3-none-any.whl
| Download URL | sqlalchemy_builder-0.1.1-py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ca0e3a2015ecaefcfeb13a884e310b210a43a83c3a5a20f3f2af854c078ddf3
|
|
BLAKE2b-256 checksum How to use checksums |
33935c5c684465cfceea49526f2422a0b8c313a4876f62e04c4af36a2f606cd8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 3, 2025.
Transparency logSecurity for sqlalchemy-builder 0.1.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for sqlalchemy_builder-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 3, 2025.
Transparency logA 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.