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.

JsonSource

A JSON document as tables: an array of objects (or one object) becomes a table, nested objects become dotted column names ('address.city'), and each nested array becomes a child table joined back through '_parent_id' = '_id'; an array member 'tags' of table 'runs' is the table 'runs_tags'. Array items that are not objects become a child table with one 'value' column. Columns are typed as JsonLinesSource types them. A name ending in '.gz' is decompressed first.

Implements: Source

Example

catalog := Catalog->New();
catalog->Load(JsonSource->New("runs.json"));
rs := catalog->Query("select r.name, t.value from runs r join runs_tags t on t._parent_id = r._id");

Operations

FromText # function

Makes a source over JSON text already in memory

function : FromText(name:String, text:String) ~ JsonSource

Parameters

NameTypeDescription
nameStringtable name
textStringJSON text

Return

TypeDescription
JsonSourcesource

GetChildTables #

Gets the child tables the last Read made: depth first, in the order their arrays were first seen, an object's members taken alphabetically

method : public : GetChildTables() ~ Vector<Table>

Return

TypeDescription
Vector<Table>child tables, empty if there are none

GetError #

Gets the reason the last read failed

method : public : GetError() ~ String

Return

TypeDescription
Stringerror, Nil if none

GetTables #

Gets the tables the document provides, the main table first; they are known only after reading it

method : public : GetTables() ~ TableSpec[]

Return

TypeDescription
TableSpectable shapes

Load #

Loads the document's tables into a catalog

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

Parameters

NameTypeDescription
catalogCatalogcatalog
hintScanHintcolumns and rows of the main table needed, Nil for everything

Return

TypeDescription
Booltrue if loaded

New # constructor

Constructor; the table is named after the file

New(path:String)

Parameters

NameTypeDescription
pathStringJSON file

New # constructor

Constructor

New(path:String, name:String)

Parameters

NameTypeDescription
pathStringJSON file
nameStringtable name

Read #

Reads the document's main table; GetChildTables then has the others

method : public : Read() ~ Table

Return

TypeDescription
Tabletable, Nil on error (see GetError)

Read #

Reads the document's main table; GetChildTables then has the others

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

Parameters

NameTypeDescription
hintScanHintcolumns and rows of the main table needed, Nil for everything

Return

TypeDescription
Tabletable, Nil on error (see GetError)