Skip to content

Execute SQL query against the registered data

Source code

Description

Parse the given SQL query and execute it against the registered frame data.

Usage

<SQLContext>$execute(query)

Arguments

query A valid string SQL query.

Value

A LazyFrame

Examples

library(polars)


query = "SELECT * FROM mtcars WHERE cyl = 4"

pl$SQLContext(mtcars = mtcars)$execute(query)
#> polars LazyFrame
#>  $describe_optimized_plan() : Show the optimized query plan.
#> 
#> Naive plan:
#>  SELECT [col("mpg"), col("cyl"), col("disp"), col("hp"), col("drat"), col("wt"), col("qsec"), col("vs"), col("am"), col("gear"), col("carb")] FROM
#>   FILTER [(col("cyl")) == (4)] FROM
#> 
#>   DF ["mpg", "cyl", "disp", "hp"]; PROJECT */11 COLUMNS; SELECTION: "None"