execute_polars_sql
Run SQL queries on local CSV or Parquet files using Polars to analyze large datasets without uploading the full data.
Instructions
Reads the data from the given file locations. Note that file_locations
can be a list of multiple files. However, all files must have the same schema
and the same columns. Executes the given polars sql query and returns the result.
Note that the polars sql query must use the table name as self to refer to the source data.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_locations | Yes | ||
| query | Yes | The polars sql query to be executed. polars sql query must use the table name as `self` to refer to the source data. Supported functions are: Aggregate: - Avg - Count - First - Last - Max - Median - Min - Sum - Quantile_count - Quantile_disc - Stddev - Sum - Variance Array: - Array_agg - Array_contains - Array_get - Array_length - Array_lower - Array_mean - Array_reverse - Array_sum - Array_to_string - Array_unique - Array_upper - Unnest Bitwise: - Bit_and - Bit_count - Bit_or - Bit_xor Conditional: - Coalesce - Greatest - If - Ifnull - Least - Nullif Mathematical: - Abs - Cbrt - Ceil - Div - Exp - Floor - Ln - Log2 - Log10 - Mod - Pi - Pow - Round - Sign - Sqrt String: - Bit_length - Concat - Concat_ws - Date - Ends_with - Initcap - Left - Length - Lower - Ltrim - Normalize - Octet_length - Regexp_like - Replace - Reverse - Right - Rtrim - Starts_with - Strpos - Strptime - Substr - Timestamp - Upper Temporal: - Date_part - Extract - Strftime Type: - Cast - Try_cast Trigonometric: - Acos - Acosd - Asin - Asind - Atan - Atand - Atan2 - Atan2d - Cot - Cotd - Cos - Cosd - Degrees - Radians - Sin - Sind - Tan - Tand | |
| file_type | No | The type of the file to be read. Supported types are csv and parquet | csv |