SQLModel Query Builder
A serializable object for simple SQLModel queries.
Why this exists
SQLModel is an Object Relation Mapper (ORM) library that provides great abstractions for interacting with relational databases, such as PostgreSQL and SQLite, via Python. SQLModel gives its users the option to write queries using its own "pythonic" functions, which is safer and easier (in my opinion) than writing raw SQL. Here's what an SQLModel looks like:
with Session(engine) as session:
statement = select(Hero, Team).join(Team).where(Team.name == "Preventers")
results = session.exec(statement)
In this example, from SQLModel's own documentation, the words Hero and Team are classes that represent tables in the database.
As convenient as it is, this approach to writing queries has a major drawback: there is no built-in to serialize SQLModel queries. The implication is that you cannot easily dump them into a JSON object that can be sent and received in a REST API, which is a major usecase when developing database applications.
Thus, sqlmodel-query-builder exists to close (or at least narrow) this gap by providing a serializable object for SQLModel queries. For now, it only supports simple queries that involve only SELECT, JOIN, and WHERE statements.
License
This work is licensed under the terms of the GPLv3.
Copyright
© 2024 Brazilian Center for Research in Energy and Materials (CNPEM)
Metadata
Release files for sqlmodel-query-builder 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| sqlmodel_query_builder-0.1.0.tar.gz | 2.6 kB | Without provenance | Details for sqlmodel_query_builder-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sqlmodel_query_builder-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for sqlmodel_query_builder-0.1.0-py3-none-any.whl |
Total release size: 6.0 kB
Release files / sqlmodel_query_builder-0.1.0.tar.gz
| Download URL | sqlmodel_query_builder-0.1.0.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9390e93f15e62db1222b875240ee32e08186093e566d3c5452bfa69128946f33
|
|
BLAKE2b-256 checksum How to use checksums |
abfa217142af1999ff560e61769ea5dfa8cbe82e10251d7e7dc57b25d8298848
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.12.8 Linux/6.12.15-200.fc41.x86_64
|
Release files / sqlmodel_query_builder-0.1.0-py3-none-any.whl
| Download URL | sqlmodel_query_builder-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e141a53f4cae6fb474f2f77a5ec9cb1e2af3a78d6493eee9d5220c55e0b3350a
|
|
BLAKE2b-256 checksum How to use checksums |
e58f64141eb4a55c5c49bdecdefb23cdf35cac31962d580f8cdde7823287e0d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.12.8 Linux/6.12.15-200.fc41.x86_64
|
Security for sqlmodel-query-builder 0.1.0
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.