Skip to content

Commit

Permalink
feat(prql-python): implement get_targets function (#1838)
Browse files Browse the repository at this point in the history
* feat(prql-python): implement get_targets function

* test(prql-python): add test for get_targets

* refactor

---------

Co-authored-by: Maximilian Roos <[email protected]>
  • Loading branch information
eitsupi and max-sixty authored Feb 15, 2023
1 parent 3d000ef commit 95a3305
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
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())

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> {
Target::names()
}

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

0 comments on commit 95a3305

Please sign in to comment.