SQLY: write SQL in SQL
SQL is a fantastic language — one of the most successful programming languages in the world. We should use it, not try to replace it with a bespoke DSL.
Yet there are a couple of things that are nice to have help with in constructing SQL queries:
- dialect-aware safe value substitution: Every database interface has its own syntax for substituting values safely (not to allow SQL injection) — for example,
$1or?or:varname. They also have different requirements for the format of the sql + values argument lists. I want to able to write my queries with the same value substituion syntax, regardless of which database interface I am using, and know that the SQL will be output correctly for my interface, and that the values will be passed to the database engine safely. - dynamic attributes: In many applications, I don't know in advance which attributes I am going to select, insert, update, or filter by. I want to SELECT a given list of attributes, or filter WHERE a given key/value mapping, or UPDATE or INSERT particular attributes, without having to rewrite the SQL query.
- block composition: Some SQL queries are very complex. I want to able to compose blocks of SQL into larger queries, so that I can manage this complexity effectively. (Most database query DSLs are unable to deal with complex queries, or they invent a hard-to-learn language for writing those queries. Learning SQL is a better use of our time, but it would be very helpful having some assistance managing/manipulating the different blocks in a query.)
SQLY:
- Dynamic value replacement, rendered in one of the supported dialects: postgres (
$1), sqlalchemy (:varname), embedded (:varname), mysql (%(varname)s), sqlite (?). Default style is embedded /:varname. - Dynamic attribute/value lists in
SELECT,WHERE,INSERT, andUPDATEsyntax. - Block composition.
- DB-API 2.0 compatibility.
Metadata
Release files for sqly 0.11.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 | |
|---|---|---|---|---|
| sqly-0.11.0.tar.gz | 22.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sqly-0.11.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 44.7 kB
Release files / sqly-0.11.0.tar.gz
| Download URL | sqly-0.11.0.tar.gz |
|---|---|
| Size | 22.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d30718225fa766b2790a719094c76ee5f6205a6112f1e28b26f2a11eebd86e82
|
|
BLAKE2b-256 checksum How to use checksums |
ca2639801ce003a60e370ba43cd1db6d46b4e1caf9502ba3f84d3780e63b6618
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / sqly-0.11.0-py2.py3-none-any.whl
| Download URL | sqly-0.11.0-py2.py3-none-any.whl |
|---|---|
| Size | 22.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
34c5257bf5657f83ecb0b4a8e2db78bc5f20019bc9f5dc7fcb1635c2e192f49e
|
|
BLAKE2b-256 checksum How to use checksums |
f7f2d9de47b38c2c80dc55dc817671ab45d128cd6808285bad5202de4767fb72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Security for sqly 0.11.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.