Skip to main content

ButtercupQL for Python

A Python-like language for SQL, named after the buttercup flower. Write a query the way you write Python, one step per line in the order the data flows; ButtercupQL compiles it to the SQL your database runs, with every value passed as a parameter.

import sqlite3
import buttercupql

query = buttercupql.compile("""
    from cases
    where status == "open" and band in ["critical", "high"]
    sort -risk
    take 20
""", dialect="sqlite")

rows = sqlite3.connect("cases.db").execute(query.sql, query.params).fetchall()

dialect is sqlite, postgres, duckdb or clickhouse. Each gets its own placeholders: ? for SQLite, $1 for PostgreSQL and DuckDB, and {p1:String} for ClickHouse; params="format" writes psycopg's %s.

  • Mistakes are shown at their place, every one at once: buttercupql.CompileError holds them, and its message shows each under its line, with a suggestion.
  • A schema checks every name: schema="CREATE TABLE cases (...)" takes the database's own statements.
  • Queries with arguments: compile(text, query="cases_for") compiles a query def with its parameters left as placeholders, and query.bind(account="A1") gives their values.
  • The command comes with the package: bcql compile query.bcql, bcql check *.bcql, and bcql lsp for editors.

The language, its design and its documentation: https://github.com/mkusiappiah/ButtercupQL.

Metadata

Release files for buttercupql 0.1.0

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

Source distribution (sdist)

Source distribution for buttercupql 0.1.0
File Size Uploaded Provenance
buttercupql-0.1.0.tar.gz 178.5 kB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for buttercupql 0.1.0
File
buttercupql-0.1.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
buttercupql-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details
buttercupql-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
buttercupql-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
buttercupql-0.1.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
buttercupql-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 5.2 MB

Release files / buttercupql-0.1.0.tar.gz

Download URL buttercupql-0.1.0.tar.gz
Size 178.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ac75585d972f783b89df08a2a8765a252cbb89485bc7a5e862b5b184f3c76ed7
BLAKE2b-256 checksum
How to use checksums
a5d5207682f29ca47d630229fbe2c51759c229e027120d725501fb4b0a630c8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / buttercupql-0.1.0-cp39-abi3-win_amd64.whl

Download URL buttercupql-0.1.0-cp39-abi3-win_amd64.whl
Size 718.4 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
3e5ac1d8bb81c003a11cfbe45f73a18346a598807f2a46e942b80c60a884e693
BLAKE2b-256 checksum
How to use checksums
3f40e894b455cbfea0d8d07a21d6986a443907da842ed5539da41867c544255b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / buttercupql-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL buttercupql-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl
Size 1.1 MB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
ef2e065dffb12b119c168f147c3ef575a641690e89c5e7a85c4d94c5f612ad06
BLAKE2b-256 checksum
How to use checksums
5966f2f30a9c51ffbeb68dac76119cb6387f23575bb70a9e9279cf2c3e3f210f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / buttercupql-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL buttercupql-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 855.1 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
a3b25bafa1fb913af5c63ccf24b8224cba4af6e01344e320cb35baf5564cafc1
BLAKE2b-256 checksum
How to use checksums
6d3941e7eccb9cceb3929cec6998c4dd18d7c5c0aecbde2637749d4d698f41b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / buttercupql-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL buttercupql-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 834.9 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
ec78ec1d98661666a1d0e161551baf35cfe33fcc05c5f4066d14224cc9a296ae
BLAKE2b-256 checksum
How to use checksums
46f3b9d605a086c60299416c3d12a453db24cd8f379f923730603b34311e06fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / buttercupql-0.1.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL buttercupql-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Size 778.8 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
00e5893c633d17cbd08ebbf717c160cf7451431c0006ebc500fca981539dcaa0
BLAKE2b-256 checksum
How to use checksums
1beb9c2f8f700e100718fe1e56c15d73f871c642e073db4aba347dc1e2a2a0eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / buttercupql-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL buttercupql-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 796.6 kB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
4f1afb527d1bce3ac69686793574a0b262402aec3ae8c0b814850a70b1719f66
BLAKE2b-256 checksum
How to use checksums
2ae73d3e2111ba9f741d3d332e125c2666641903b4cb687ce07907bf9247d4c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for buttercupql 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

7 release files No provenance

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