Struct polars_sql::SQLContext 
source · Fields§
§table_map: PlHashMap<String, LazyFrame>Implementations§
source§impl SQLContext
 
impl SQLContext
pub fn try_new() -> PolarsResult<Self>
pub fn register(&mut self, name: &str, lf: LazyFrame)
sourcepub fn execute_statement(&self, stmt: &Statement) -> PolarsResult<LazyFrame>
 
pub fn execute_statement(&self, stmt: &Statement) -> PolarsResult<LazyFrame>
Examples found in repository?
src/context.rs (line 233)
223 224 225 226 227 228 229 230 231 232 233 234
    pub fn execute(&self, query: &str) -> PolarsResult<LazyFrame> {
        let ast = Parser::parse_sql(&GenericDialect::default(), query)
            .map_err(|e| PolarsError::ComputeError(format!("{:?}", e).into()))?;
        if ast.len() != 1 {
            return Err(PolarsError::ComputeError(
                "One and only one statement at a time please".into(),
            ));
        }
        let ast = ast.get(0).unwrap();
        return self.execute_statement(ast);
    }pub fn execute(&self, query: &str) -> PolarsResult<LazyFrame>
Trait Implementations§
source§impl Clone for SQLContext
 
impl Clone for SQLContext
source§fn clone(&self) -> SQLContext
 
fn clone(&self) -> SQLContext
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from 
source. Read moresource§impl Default for SQLContext
 
impl Default for SQLContext
source§fn default() -> SQLContext
 
fn default() -> SQLContext
Returns the “default value” for a type. Read more