Skip to main content

A library for building inline SQL queries safely using python callables.

Project description

lonny_common_sql

A library for building inline SQL queries safely using python callables.

Installation:

pip install lonny_common_sql

Usage:

Usage is very straightforward. Please see example below:

from lonny_common_sql import build

table = "TABLE"
value = "VALUE"

sql, params = build(lambda w: f"""
    SELECT * FROM {table}
    WHERE value = {w(value)}
""")

We simply pass build a callable that takes a wrapper argument. This wrapper is itself a callable that returns the substituted parameter name whilst simultaneously adds the value to the parameter dictionary to be returned along with the finalized SQL.

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

lonny_common_sql-0.1.1.tar.gz (2.5 kB view hashes)

Uploaded Source

Built Distribution

lonny_common_sql-0.1.1-py3-none-any.whl (3.0 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