-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
135 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Python bindings to `prqlc` | ||
|
||
The `prqlc-python` crate offer Rust bindings to the `prqlc` Rust library, | ||
published to a python package named `prqlc`. | ||
|
||
The main entry point is a Python method `prqlc.compile(query: str) -> str`. | ||
|
||
The package is consumed by [pyprql](https://github.com/prql/pyprql) & | ||
[dbt-prql](https://github.com/prql/dbt-prql). | ||
|
||
<!-- TODO: change --> | ||
<!-- <https://pypi.org/project/prqlc/>. --> | ||
|
||
The crate is not published to crates.io; only to PyPI at | ||
<https://pypi.org/project/prql-python/>. | ||
|
||
## Installation | ||
|
||
`pip install prqlc` | ||
|
||
## Usage | ||
|
||
```python | ||
import prqlc | ||
|
||
prql_query = """ | ||
from employees | ||
join salaries (==emp_id) | ||
group {employees.dept_id, employees.gender} ( | ||
aggregate { | ||
avg_salary = average salaries.salary | ||
} | ||
) | ||
""" | ||
|
||
options = prqlc.CompileOptions( | ||
format=True, signature_comment=True, target="sql.postgres" | ||
) | ||
|
||
sql = prqlc.compile(prql_query) | ||
sql_postgres = prqlc.compile(prql_query, options) | ||
``` | ||
|
||
Relies on [pyo3](https://github.com/PyO3/pyo3) for all the magic. |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.