pyprql
pyprql contains:
- pyprql.pandas_accessor — Pandas integration for PRQL
- pyprql.polars_namespace — Polars integration for PRQL
- pyprql.magic — IPython magic for connecting to databases using
%%prql - pyprql.compile — An export of
prqlc'scompilefunction
For docs, check out the pyprql docs, and the PRQL Book.
Installation
pip install pyprql
Or, install with optional dependencies:
pip install pyprql[polars]
Usage
Pandas integration
import pandas as pd
import pyprql.pandas_accessor
df = (...)
results_df = df.prql.query("select {age, name, occupation} | filter age > 21")
Polars integration
import polars as pl
import pyprql.polars_namespace
df = (...)
results_df = df.prql.query("select {age, name, occupation} | filter age > 21")
Jupyter Magic
In [1]: %load_ext pyprql.magic
In [2]: %prql postgresql://user:password@localhost:5432/database
In [3]: %%prql
...: from p
...: group categoryID (
...: aggregate {average unitPrice}
...: )
In [4]: %%prql results <<
...: from p
...: aggregate {min unitsInStock, max unitsInStock}
Compilation
This library exposes prqlc.compile, so we can simply generate SQL:
import pyprql
pyprql.compile("from artists | select track")
print(pyprql.compile("from artists | select track"))
...returns...
SELECT
track
FROM
artists
For context, prqlc in Python is the Python binding for the prqlc Rust crate, so only
contains functions for compilation; and this library offers broader python
integrations and tooling.
Support
This project was created by @charlie-sanders & @rbpatt2019 and is now maintained by the broader PRQL team.
Metadata
Release files for pyprql 0.13.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyprql-0.13.0.tar.gz | 17.8 kB | With provenance | Details for pyprql-0.13.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyprql-0.13.0-py3-none-any.whl | Python 3 | none | any | Details for pyprql-0.13.0-py3-none-any.whl |
Total release size: 39.0 kB
Release files / pyprql-0.13.0.tar.gz
| Download URL | pyprql-0.13.0.tar.gz |
|---|---|
| Size | 17.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ce248b06888b566bf517aebf3a371cf4f3db051863951f3ae513f63b9582ac73
|
|
BLAKE2b-256 checksum How to use checksums |
7a952e62878cbd02e25149ddd3b891c66a95762bee44669e4d92e4ae3c0c66bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 7, 2025.
Transparency logRelease files / pyprql-0.13.0-py3-none-any.whl
| Download URL | pyprql-0.13.0-py3-none-any.whl |
|---|---|
| Size | 21.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4f0df8abca05ce15717dd6ac7e3e9f9a41d9be67d881f1fe553a7ad3650919e2
|
|
BLAKE2b-256 checksum How to use checksums |
32cf534c75c7b34185f244d3dface594009cc9490cbfc1ef61ad80a83428e315
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 7, 2025.
Transparency logSecurity for pyprql 0.13.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pyprql-0.13.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 7, 2025.
Transparency logA 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.