Skip to main content

polars_python/
cloud_client.rs

1use pyo3::prelude::{Python, *};
2use pyo3::types::PyBytes;
3
4use crate::PyLazyFrame;
5use crate::error::PyPolarsErr;
6
7#[pyfunction]
8pub fn prepare_cloud_plan(
9    lf: PyLazyFrame,
10    allow_local_scans: bool,
11    py: Python<'_>,
12) -> PyResult<(Bound<'_, PyBytes>, u32)> {
13    let lf = lf.ldf.into_inner();
14    let opt_flags = lf.get_current_optimizations();
15    let plan = lf.logical_plan;
16    let bytes =
17        polars::prelude::prepare_cloud_plan(plan, allow_local_scans).map_err(PyPolarsErr::from)?;
18
19    Ok((PyBytes::new(py, &bytes), opt_flags.bits()))
20}