Alternative Queries
Alternative queries is a library created to help with handcrafted SQL queries.
It works by providing a class that represent the queries where its parameter
types are checked by Pydantic.
If you want to write reusable and nested handcrafted SQL queries, you can check more information on the Alternative Queries Documentation. If you want to know how Alternative Queries can help you, check the Why use Alternative Queries? section of the documentation.
Installation
The library is available in the Python Package Index.
pip install altqq
Quick Start
To start, define a class by inheriting the altqq.Query class. The class should
have a query following the python formatting standards. The variable names
inside the __query__ must match the other attributes defined on the class.
import altqq
class SelectUserByFirstName(altqq.Query):
__query__ = """
SELECT * FROM "Users"
WHERE first_name = {first_name}
"""
first_name: str
The class can be used like a dataclass. In fact, classes inheriting the
altqq.Query class are turned into a Pydantic dataclass.
query = SelectUserByFirstName(first_name="arietta")
The object can be converted into a query suitable for a DBMS library of your
choice. For example, calling the altqq.to_pyodbc function will convert the
object to PyODBCQuery which provides the query string and the parameters.
pyodbc_query = altqq.to_pyodbc(query)
print(pyodbc_query.query)
#
# SELECT * FROM "Users"
# WHERE first_name = ?
#
print(pyodbc_query.parameters)
# ['arietta']
Metadata
Release files for altqq 0.0.9
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 |
|---|---|---|---|---|
| altqq-0.0.9.tar.gz | 6.8 kB | Without provenance | Details for altqq-0.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| altqq-0.0.9-py3-none-any.whl | Python 3 | none | any | Details for altqq-0.0.9-py3-none-any.whl |
Total release size: 17.4 kB
Release files / altqq-0.0.9.tar.gz
| Download URL | altqq-0.0.9.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e25da2b584b86c0bf630a64a85da5b18a2250f4dc0ea05a27d362b0d4de033d4
|
|
BLAKE2b-256 checksum How to use checksums |
1bac1793f7ff79e0c7d392f59c1bcd400ff94e5bb8494bb78e571082a4d436b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.12.3 Linux/6.11.0-1018-azure
|
Release files / altqq-0.0.9-py3-none-any.whl
| Download URL | altqq-0.0.9-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
39e9ddf27d5eb6fecaadf1c68bf6a0fdb8077033ac1247336ba1de860fce1ea0
|
|
BLAKE2b-256 checksum How to use checksums |
1ed3f3da6acbc4bd2d8678939bac3a33f559290eb8d67ae21ca9e17c145b57a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.12.3 Linux/6.11.0-1018-azure
|
Security for altqq 0.0.9
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.