CSV

The csv driver loads separated text fields into Polars SQL.

URL format

csv://<file>[?has_header=<true|false>&quote=<char>&skip_rows=<rows>]

Options

OptionBehavior / default
has_headerUse the first row as column names; default true.
skip_rowsRows to skip before reading the header/data; default 0.
skip_rows_after_headerRows to skip after the header; default 0.
quoteSingle ASCII quote character. Quoting is disabled by default; use %22 for double quotes.
eolSingle ASCII line terminator; default newline (%0A).
truncate_ragged_linesTruncate rows wider than the inferred schema when true; default false.
infer_schema_lengthRows used to infer column types; default 100. Set 0 to examine all rows.
ignore_errorsIgnore reader conversion errors when true; default false.

Examples

rsql --url 'csv://people.csv?quote=%22' -- 'SELECT * FROM people LIMIT 10;'

Usage notes

The field separator is fixed to comma.

Use a relative path such as csv://people.csv or an absolute path such as csv:///data/people.csv. Percent-encode spaces and URL delimiters in filenames.

The file is loaded into an in-memory Polars SQL context. Its table name is the filename before the first dot: people.csv becomes people. Use .tables and .describe people to inspect the imported data. Query results and session changes do not write back to the source file.