Slide 10 of 37

Tables and CSV

proc main(): void {
	hive.file.write("./tour.csv", "name,role\nada,engineer\ngrace,admiral\n")

	csv := using "./tour.csv"
	if csv is Result.Ok(table) {
		if len(table) > 1 {
			echo table[1:]   // every row after the header
		}
	}
}
Table is an alias for Str[dyn][dyn]: a vector of rows of cells. It is what `using` yields from a CSV, what a raw SQL query answers with, and what hive.map.toTable builds. A bare `using "path"` reads a comma-separated file; adding `as csv separating by "<sep>"` picks a different delimiter, such as a tab for a TSV — and every form answers with a Result, so the source says exactly which reader the build needs to link in.