SQL file readers and table functions
Query CSV and Parquet files or expand lists into rows with Haybarn SQL. Work through small examples that run in the browser.
Choose a function
Table functions belong in FROM and produce rows for the rest of the query. Start with a small sample, inspect the column types, and select the columns your analysis actually needs.
read_csv()Read CSV with inferred or explicit column types.read_parquet()Read typed Parquet columns.unnest()Turn list items into rows.
Browser examples use the engineβs virtual filesystem. A path on your computer is not automatically available to the browser engine. Remote files also need a server that permits browser access.
Query CSV files with SQL
Read a CSV file as a table and query its columns directly. Set header and column types explicitly when the file format is known.
The example creates a small CSV in the browser engineβs virtual filesystem, then reads it with an explicit schema. A unique filename lets the example run repeatedly.
Guide example Β· Run to view results.
| product_id | quantity |
|---|---|
0012 | 5 |
Watch for: Type inference can lose leading zeroes in identifiers. Declare such columns as VARCHAR. Browser queries cannot open arbitrary paths on your computer.
All files & tables functions
19 functions in Haybarn WASM 2.0.0-rc12. Browse the filtered catalog β
glob()parquet_bloom_probe()parquet_file_metadata()parquet_full_metadata()parquet_kv_metadata()parquet_metadata()parquet_scan()parquet_schema()read_arrow()read_blob()read_csv()Read a CSV file as a table and query its columns directly. Set header and column types explicitly when the file format is known.
read_csv_auto()read_duckdb()read_parquet()Read typed columns from a Parquet file directly in a FROM clause, selecting and filtering the fields needed by your query.
read_single_csv_file()read_single_parquet_file()read_text()sniff_csv()unnest()Expand a list into individual rows so each item can be filtered, joined, or aggregated with ordinary SQL.