Expand description
read_parquet(path), read_csv(path, header => false) and
read_json(path): files as tables, as in DuckDB.
Each is a thin wrapper over the path: FROM read_csv('edges.csv') reads
the same table as FROM 'edges.csv' ([crate::file_table]), so a relative
path, a glob, a directory or a URL behaves the same, and a graph’s index
cache knows the files by the same identity. What the function adds is the
format, whatever the extension, and a few options:
read_csv:header,delim(orsepordelimiter),quote,compression;read_json:compression, andformat => 'array'for a file holding one JSON array of objects rather than one object per line;read_parquet: none.
The first argument is a path or a list of paths (['a.csv', 'b.csv']).
Options are named, name => value as Ursa’s graph functions take them,
or name = value as DuckDB writes them. read_csv_auto, read_json_auto
and read_ndjson are DuckDB’s other names for the same functions.
§Opened before planning
Opening files is async (it lists them and infers a schema), and a relation
planner is not. So open_reads walks a statement before it is planned,
opens every read_* call in it, and keeps each table under the call’s
text in the session’s ReadTables; ReadFunctions, the relation
planner, then finds the table there by the same text. Ursa’s SQL layer
(ursa_sql::execute) does this for every statement, so a call in a view,
a subquery, a CTE, a COPY or an EXPLAIN is opened too.
Structs§
- Open
Reads - The tables
open_readsopened for one statement. Dropping it forgets them, once the statement is planned. - Read
Functions - Plans
read_*calls inFROMas scans of the tablesopen_readsopened. - Read
Tables - The tables of the
read_*calls in the statements being planned, by the call’s text, with how many statements are using each.
Functions§
- names
- The names of the
read_*functions. - open_
reads - Open the table of every
read_*call instatement, forReadFunctionsto plan. Keep the result until the statement is planned. - paths_
mut - The paths
factorreads, if it is aread_*call: the strings of its first argument, for a database to rewrite relative to its directory.