Simple library for dynamic SQL queries
Project description
AlmaSQL
Directives
Directives are functions that can extend AlmaSQL by customizing the way an expression renders.
Using a directive in your template is as simple as calling a function in a template expression.
AlmaSQL includes a number of built-in directives like set
and values
.
Users can also write their own custom directives.
set
Imagine table book
and columns id
, title
, and is_active
.
And you want to update book by id.
UPDATE book
SET title = :title, is_active = :is_active
WHERE id = :id
But when you need to modify column, you need to change the query template. What if you forgot to do it? This will lead to unexpected bugs. So better to use directives that, depending on the arguments, will render the required columns and values.
UPDATE book{{ set({'title': 'Why do I love almasql?', 'is_active': True}) }}
WHERE id = :id
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file almasql-0.2.5.tar.gz
.
File metadata
- Download URL: almasql-0.2.5.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Darwin/22.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca1474b5ea2b956d1b1ecce02b3094e31b6ebed16cfa6583581938501fb7e51e |
|
MD5 | aa6a603f3582d607764d3e223dc31430 |
|
BLAKE2b-256 | 23a2bb92728fe0ceee72528ce1b61be856cd3ca2ac689ee55b7d8ec150c349f0 |
Provenance
File details
Details for the file almasql-0.2.5-py3-none-any.whl
.
File metadata
- Download URL: almasql-0.2.5-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Darwin/22.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 701a07d6231d69765aa9736c78896533c57ca2908b030ccda6a76c094f3cee10 |
|
MD5 | 37a0b114cad809e9540d4021e95c90ad |
|
BLAKE2b-256 | 8cfcf957f411706b234dae504d069e08a4d74b652a414979af3ffd3f954e6ff0 |