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.6.tar.gz
.
File metadata
- Download URL: almasql-0.2.6.tar.gz
- Upload date:
- Size: 6.4 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 | c09f232b7708476fc4b046058a9741d3331209e5532e8f5d95bf6071e730a037 |
|
MD5 | bc99ce6bda6bd52538e2c22a1d669bbc |
|
BLAKE2b-256 | 18b61fe5e6838e23cba4ed5d9e4ea2ffc8b0f93b4ff89b6a5ae47fb6eb3ca5e0 |
File details
Details for the file almasql-0.2.6-py3-none-any.whl
.
File metadata
- Download URL: almasql-0.2.6-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 | ee2e5354526c1003f0a88e0405d345ab92872e803d29b2a13bb8f8d389666540 |
|
MD5 | 96dd2c8ada067ac3c901a77e5fbf448c |
|
BLAKE2b-256 | b0ae4c669cdf72936cdb17baa78ab40815b864677e06f1c8f2bd61169c2757be |