v2026.11.2
All Bundles
Bundle

In-memory query engine over typed columns. Tables are filled row by row or loaded from sources (CSV files, folders, the program's own objects) and queried with SQL-like statements; aggregates, Describe() and Finder (file search) are included. Compile with -lib query.

CsvSource

A CSV file as a table. Each column is typed by reading all of it: whole numbers make an INT column, numbers with a fraction or exponent a FLOAT column, '#MM/dd/yyyy#' cells a DATE column, and anything else, including any mix of numbers and text, a STRING column. An empty cell is empty, not an empty string. Quoting follows RFC 4180 through Data.CSV.

Implements: Source

Example

catalog := Catalog->New();
if(catalog->Load(CsvSource->New("runs.csv"))) {
  catalog->Get("runs")->Describe()->ToString()->PrintLine();
};

Operations

FromText # function

Makes a source over CSV text already in memory

function : FromText(name:String, text:String, delimiter:Char) ~ CsvSource

Parameters

NameTypeDescription
nameStringtable name
textStringCSV text
delimiterCharfield delimiter

Return

TypeDescription
CsvSourcesource

GetError #

Gets the reason the last read failed

method : public : GetError() ~ String

Return

TypeDescription
Stringerror, Nil if none

GetTables #

Gets the table the file provides; its column types are known only after reading it

method : public : GetTables() ~ TableSpec[]

Return

TypeDescription
TableSpecone table shape

Load #

Loads the file into a catalog

method : public : Load(catalog:Catalog, hint:ScanHint) ~ Bool

Parameters

NameTypeDescription
catalogCatalogcatalog
hintScanHintcolumns and rows needed, Nil for everything

Return

TypeDescription
Booltrue if loaded

New # constructor

Constructor. The table is named after the file, without its directory or extension.

New(path:String)

Parameters

NameTypeDescription
pathStringCSV file

New # constructor

Constructor

New(path:String, name:String, delimiter:Char)

Parameters

NameTypeDescription
pathStringCSV file
nameStringtable name
delimiterCharfield delimiter, such as ',', ';' or '\t'

ParseText # function

Parses CSV text, accepting a header with no rows as an empty table

function : ParseText(text:String, delimiter:Char) ~ ParsedCsv

Parameters

NameTypeDescription
textStringCSV text
delimiterCharfield delimiter

Return

TypeDescription
ParsedCsvparsed table and its number of data rows, Nil if the text is not CSV

Read #

Reads the file as a table

method : public : Read(hint:ScanHint) ~ Table

Parameters

NameTypeDescription
hintScanHintcolumns and rows needed, Nil for everything

Return

TypeDescription
Tabletable, Nil on error (see GetError)

SetHeader #

Sets whether the first line names the columns (the default). Without a header every line is data and the columns are named c1, c2 and so on.

method : public : SetHeader(header:Bool) ~ Nil

Parameters

NameTypeDescription
headerBooltrue if the first line is a header