Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(prql-python): implement get_targets function #1838

Merged
merged 5 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions prql-python/python/tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def test_all():
res = prql.rq_to_sql(res)
assert res is not None

assert len(prql.get_targets()) > 0
eitsupi marked this conversation as resolved.
Show resolved Hide resolved

assert prql.__version__ is not None

# Example from readme
Expand Down
6 changes: 6 additions & 0 deletions prql-python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ fn prql_python(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_pyfunction!(prql_to_pl, m)?)?;
m.add_function(wrap_pyfunction!(pl_to_rq, m)?)?;
m.add_function(wrap_pyfunction!(rq_to_sql, m)?)?;
m.add_function(wrap_pyfunction!(get_targets, m)?)?;
m.add_class::<CompileOptions>()?;
// From https://github.com/PyO3/maturin/issues/100
m.add("__version__", env!("CARGO_PKG_VERSION"))?;
Expand Down Expand Up @@ -104,6 +105,11 @@ impl From<CompileOptions> for prql_compiler::Options {
}
}

#[pyfunction]
pub fn get_targets() -> Vec<String> {
prql_compiler::Target::names()
eitsupi marked this conversation as resolved.
Show resolved Hide resolved
}

#[cfg(not(feature = "extension-module"))]
#[cfg(test)]
mod test {
Expand Down