Python extensions for PRQL
Project description
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.
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyprql-0.13.0.tar.gz.
File metadata
- Download URL: pyprql-0.13.0.tar.gz
- Upload date:
- Size: 17.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce248b06888b566bf517aebf3a371cf4f3db051863951f3ae513f63b9582ac73
|
|
| MD5 |
0920ed460c495d42a8a7f518e8deeb83
|
|
| BLAKE2b-256 |
7a952e62878cbd02e25149ddd3b891c66a95762bee44669e4d92e4ae3c0c66bc
|
Provenance
The following attestation bundles were made for pyprql-0.13.0.tar.gz:
Publisher:
release.yaml on PRQL/pyprql
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyprql-0.13.0.tar.gz -
Subject digest:
ce248b06888b566bf517aebf3a371cf4f3db051863951f3ae513f63b9582ac73 - Sigstore transparency entry: 169611539
- Sigstore integration time:
-
Permalink:
PRQL/pyprql@90ce1050d0910cb087d6730267a55c2816a654c7 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/PRQL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@90ce1050d0910cb087d6730267a55c2816a654c7 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pyprql-0.13.0-py3-none-any.whl.
File metadata
- Download URL: pyprql-0.13.0-py3-none-any.whl
- Upload date:
- Size: 21.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f0df8abca05ce15717dd6ac7e3e9f9a41d9be67d881f1fe553a7ad3650919e2
|
|
| MD5 |
eabb611ab8cb0fb6e01accd4ed3b69ef
|
|
| BLAKE2b-256 |
32cf534c75c7b34185f244d3dface594009cc9490cbfc1ef61ad80a83428e315
|
Provenance
The following attestation bundles were made for pyprql-0.13.0-py3-none-any.whl:
Publisher:
release.yaml on PRQL/pyprql
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyprql-0.13.0-py3-none-any.whl -
Subject digest:
4f0df8abca05ce15717dd6ac7e3e9f9a41d9be67d881f1fe553a7ad3650919e2 - Sigstore transparency entry: 169611541
- Sigstore integration time:
-
Permalink:
PRQL/pyprql@90ce1050d0910cb087d6730267a55c2816a654c7 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/PRQL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@90ce1050d0910cb087d6730267a55c2816a654c7 -
Trigger Event:
workflow_dispatch
-
Statement type: