{"id":26426329,"url":"https://github.com/prql/pyprql","last_synced_at":"2025-04-09T05:08:31.976Z","repository":{"id":39609851,"uuid":"455355789","full_name":"PRQL/pyprql","owner":"PRQL","description":"Python extensions for PRQL","archived":false,"fork":false,"pushed_at":"2025-03-31T18:17:31.000Z","size":2341,"stargazers_count":100,"open_issues_count":11,"forks_count":5,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-01T22:44:24.983Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pyprql.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PRQL.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-03T22:56:55.000Z","updated_at":"2025-03-31T18:17:33.000Z","dependencies_parsed_at":"2023-02-16T10:30:35.918Z","dependency_job_id":"863e93c8-af04-4682-9b7b-be3af87a6679","html_url":"https://github.com/PRQL/pyprql","commit_stats":{"total_commits":366,"total_committers":14,"mean_commits":"26.142857142857142","dds":0.6229508196721312,"last_synced_commit":"917062e0850a96c6d7e9623abfb3f0a9c9397263"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PRQL%2Fpyprql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PRQL%2Fpyprql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PRQL%2Fpyprql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PRQL%2Fpyprql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PRQL","download_url":"https://codeload.github.com/PRQL/pyprql/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247980837,"owners_count":21027808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-18T03:29:37.201Z","updated_at":"2025-04-09T05:08:31.956Z","avatar_url":"https://github.com/PRQL.png","language":"Python","readme":"# pyprql\n\n[![CI/CD](https://github.com/prql/pyprql/actions/workflows/pull-request.yaml/badge.svg?branch=main)](https://github.com/prql/pyprql/actions/workflows/pull-request.yaml)\n[![Documentation Status](https://readthedocs.org/projects/pyprql/badge/?version=latest)](https://pyprql.readthedocs.io/en/latest/?badge=latest)\n\n![PyPI](https://img.shields.io/pypi/v/pyprql)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyprql)\n[![Codestyle: Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n\u003c!-- [![codecov](https://codecov.io/gh/prql/PyPrql/branch/main/graph/badge.svg?token=C6J2UI7FR5)](https://codecov.io/gh/prql/PyPrql) --\u003e\n\npyprql contains:\n\n- pyprql.pandas_accessor — Pandas integration for PRQL\n- pyprql.polars_namespace — Polars integration for PRQL\n- pyprql.magic — IPython magic for connecting to databases using `%%prql`\n- pyprql.compile — An export of `prqlc`'s `compile` function\n\nFor docs, check out the [pyprql docs](https://pyprql.readthedocs.io/), and the\n[PRQL Book][prql_docs].\n\n## Installation\n\n```sh\npip install pyprql\n```\n\nOr, install with optional dependencies:\n\n```sh\npip install pyprql[polars]\n```\n\n## Usage\n\n### Pandas integration\n\n```python\nimport pandas as pd\nimport pyprql.pandas_accessor\n\ndf = (...)\nresults_df = df.prql.query(\"select {age, name, occupation} | filter age \u003e 21\")\n```\n\n### Polars integration\n\n```python\nimport polars as pl\nimport pyprql.polars_namespace\n\ndf = (...)\nresults_df = df.prql.query(\"select {age, name, occupation} | filter age \u003e 21\")\n```\n\n### Jupyter Magic\n\n```python\nIn [1]: %load_ext pyprql.magic\nIn [2]: %prql postgresql://user:password@localhost:5432/database\nIn [3]: %%prql\n   ...: from p\n   ...: group categoryID (\n   ...:   aggregate {average unitPrice}\n   ...: )\nIn [4]: %%prql results \u003c\u003c\n   ...: from p\n   ...: aggregate {min unitsInStock, max unitsInStock}\n\n```\n\n### Compilation\n\nThis library exposes `prqlc.compile`, so we can simply generate SQL:\n\n```python\nimport pyprql\npyprql.compile(\"from artists | select track\")\nprint(pyprql.compile(\"from artists | select track\"))\n```\n\n...returns...\n\n```sql\nSELECT\n  track\nFROM\n  artists\n```\n\nFor context, `prqlc` in Python is the Python binding for the `prqlc` Rust crate, so only\ncontains functions for compilation; and this library offers broader python\nintegrations and tooling.\n\n## Support\n\nThis project was created by\n[@charlie-sanders](https://github.com/charlie-sanders/) \u0026\n[@rbpatt2019](https://github.com/rbpatt2019) and is now maintained by the\nbroader PRQL team.\n\n[prql_docs]: https://prql-lang.org/book\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprql%2Fpyprql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprql%2Fpyprql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprql%2Fpyprql/lists"}