parent
3af97c71f0
commit
2b18f7b5e3
@ -1,15 +1,10 @@
|
||||
use polars::sql::SQLContext;
|
||||
use polars_lazy::frame::LazyFrame;
|
||||
use polars_sql::SQLContext;
|
||||
use polars_lazy::prelude::LazyFrame;
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
context
|
||||
.execute(statement)
|
||||
.expect("Could not execute statement")
|
||||
}
|
||||
|
Loading…
Reference in new issue