Skip to main content

# SQL-query

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, $1 or ? 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 having some assistance managing/manipulating the different blocks in a query would be very helpful.)

Behold SQL-query: [OUTDATED]

  • One class, SQL, with one field, query, and one method, .render, which takes one optional argument, dialect.

  • Dynamic value replacement, rendered in one of the supported dialects: postgresql ($1), sqlalchemy (:varname), embedded (:varname), mysql (%(varname)s), sqlite (?). Default style is :varname.

  • Dynamic attribute/value lists in SELECT, WHERE, INSERT, and UPDATE syntax via ??? [TBD]

  • Block composition via ??? [TBD]

Metadata

Release files for sql-query 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sql-query 0.4.1
File Size Uploaded Provenance
sql-query-0.4.1.tar.gz 3.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sql-query 0.4.1
File Interpreter ABI Platform
sql_query-0.4.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 13.0 kB

Release files / sql-query-0.4.1.tar.gz

Download URL sql-query-0.4.1.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
93dbf4f1856c4a5b5b2eb9ebaf9c1b3d4fbb5f762bede503c42e8f3198e856e4
BLAKE2b-256 checksum
How to use checksums
55a05a95349bb1708a21a33b37f453be828f8166a2ea87f42ad3d1b6d0826567
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Release files / sql_query-0.4.1-py2.py3-none-any.whl

Download URL sql_query-0.4.1-py2.py3-none-any.whl
Size 9.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
22c87c30f11aa6be982a13f53770603bf4f6d1c776dd99de8e11cca0a3a93b9b
BLAKE2b-256 checksum
How to use checksums
7378689470fb5f9ea86d634bf9b8715396cfaa2e292ca2d7a2c216050d907452
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Security for sql-query 0.4.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.

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page