Reading tabular data
Read table data into JavaScript
import redivis from 'redivis';
// Specify the table's container, either a dataset or workflow
const dataset = redivis.organization('demo').dataset('iris_species');
const table = dataset.table('iris');
// An array of row objects
const rows = await table.toRowsArray();
// [
// { Id: 33, SepalLengthCm: 5.2, SepalWidthCm: 4.1, PetalLengthCm: 1.5, PetalWidthCm: 0.1, Species: 'Iris-setosa' },
// ...
// ]
// Only read certain variables, and a maximum number of rows
const someRows = await table.toRowsArray(10, { variables: ['Species', 'SepalLengthCm'] });
// An Apache Arrow table
const arrowTable = await table.toArrowTable();
// Other methods to read data:
// table.toArrowBatchIterator()
// await table.toReadStreams()Stream data
For tables that are too large to fit in memory, stream the data one arrow RecordBatch at a time:
Using other libraries
Apache Arrow is widely supported, so an arrow Table can be handed directly to many other JavaScript data tools:
Work with dates and large integers
By default, toRowsArray() returns dates and times as Temporal values, and integers as numbers. See Data types for details.
Read table metadata
Read data in parallel
Was this helpful?

