You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
432 B
16 lines
432 B
use polars_lazy::lazy::LazyFrame;
|
|
use polars::sql::SQLContext;
|
|
|
|
pub fn execute(ldf: LazyFrame, statement: &String) -> LazyFrame {
|
|
let mut context = SQLContext::try_new().expect("Could not create context");
|
|
context.register("this", ldf);
|
|
|
|
match context.execute(statement) {
|
|
Ok(res) => res,
|
|
Err(e) => {
|
|
eprintln!("Query execution error {e}");
|
|
LazyFrame::default()
|
|
}
|
|
}
|
|
}
|