Skip to main content

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

almasql-0.2.6.tar.gz (6.4 kB view hashes)

Uploaded Source

Built Distribution

almasql-0.2.6-py3-none-any.whl (8.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page