Table
Work with tables on Redivis
class Table
Tables are the fundamental data-containing entity in Redivis. Tables belong to either a dataset or workflow, and are made up of rows and variables (columns). Various methods allow you to read table data, as well as to create / update / delete tables belonging to an unreleased version of a dataset.
Certain tables may be file index tables, which represent a collection of non-tabular files, where each row corresponds to a file. There are additional methods available on file index tables that allow for you to interface with these files.
Constructors
redivis.table(name[, options])
Return a Table within the current default scope (either a dataset or workflow). If no default scope is specified, the name must be fully qualified (e.g., demo.iris_species.iris). Consult the referencing resources documentation to learn more.
Dataset.table(name)
Return a Table within a specific dataset. The name does not need to be fully qualified, since the table lookup is already scoped to a dataset.
Workflow.table(name)
Return a Table within a specific workflow. The name does not need to be fully qualified, since the table lookup is already scoped to a workflow.
Dataset.listTables([maxResults])
Returns a list of Tables within a dataset.
Workflow.listTables([maxResults, options])
Returns a list of Tables within a workflow.
Examples
const table = redivis.table('demo.iris_species.iris'); // owner.dataset|workflow.table
await table.exists(); // -> true
await table.get(); // table.properties is now populated with the table resource definition
table.variable('SepalLengthCm'); // -> Returns a Variable
await table.toRowsArray(); // -> Returns an array of row objects
await table.file('filename.png'); // -> Returns a File in a file index table// Can also do: redivis.table('demo.iris_species.iris')
const dataset = redivis.organization('demo').dataset('iris_species');
const table = dataset.table('iris');
const rows = await table.toRowsArray();
// [
// { Id: 33, SepalLengthCm: 5.2, SepalWidthCm: 4.1, PetalLengthCm: 1.5, PetalWidthCm: 0.1, Species: 'Iris-setosa' },
// ...
// ]
// Other methods to read data:
// await table.toArrowTable()
// table.toArrowBatchIterator()
// await table.toReadStreams()Attributes
dataset
A reference to the Dataset that the table belongs to. Will be undefined if the table belongs to a workflow.
workflow
A reference to the Workflow that the table belongs to. Will be undefined if the table belongs to a dataset.
name
The table's name.
properties
An object containing the API resource representation of the table. This will only be populated after certain methods are called, particularly the get method, and will otherwise be undefined.
qualifiedReference
The fully qualified reference to this table, for use (e.g.) in a SQL query. For example, demo.reddit:prpw:v1_0.posts:7q4m
scopedReference
The canonical reference for the table, without any qualifiers. E.g., posts:7q4m
Methods
Reading data and metadata
Table.download([path, options])
Export the table in a particular format and download it to disk (Node.js only).
Check whether the table exists.
Table.file(path)
Return a File within a file index table.
Fetch table metadata. Once called, the properties attribute on the table will be fully populated.
Table.listFiles([maxResults, options])
Return a list of File instances in a file index table.
Table.listVariables([maxResults])
Return a list of Variable instances associated with this table.
Table.toArrowBatchIterator([maxResults, options])
Return an async iterator of arrow RecordBatches, for processing the table's data in a memory-efficient streaming manner.
Table.toArrowTable([maxResults, options])
Return an arrow Table with the table's data.
Table.toDirectory([options])
Return a Directory of the files in a file index table.
Table.toReadStreams([targetCount, options])
Return a list of ReadStreams, for reading the table in parallel.
Table.toRowsArray([maxResults, options])
Return an array of row objects with the table's data.
Table.updateVariables(variables)
Batch update variable metadata on the table.
Table.variable(name)
Return a Variable within the table.
Uploading and modifying data
Table.addFiles(options)
Upload non-tabular files to an unreleased file index table.
Table.create([options])
Create a table within an unreleased version of a dataset.
Delete a table belonging to an unreleased version of a dataset.
Table.listUploads([maxResults])
Return a list of Uploads on the table.
Table.update(options)
Update properties on the table (name, description, uploadMergeStrategy).
Table.upload([name])
Return an Upload on the table, which can subsequently be used to upload tabular data.
Was this helpful?

