Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Upload

class Upload

Uploads are the interface for bringing data into Redivis. They are associated with a particular table, and can be created on any table belonging to an unreleased version of a dataset. Multiple uploads can be added to a table, in which case they are "stacked" together (equivalent to a union join, with mixed schemas supported).

Constructors

Method
Description

Table.upload([name])

Construct a reference to an upload. name is optional, and will be inferred from the uploaded file's name if not provided.

Table.listUploads([maxResults])

List the uploads on a table.

Examples

const dataset = redivis.user('user_name').dataset('dataset_name', { version: 'next' });
const table = dataset.table('table_name');

// In Node.js, upload a file from disk
await table.upload().create('./data.csv');

// In the browser, upload a File (e.g., from an <input type="file">)
await table.upload().create(fileInput.files[0], {
  onProgress: ({ bytesUploaded, totalBytes }) => console.log(bytesUploaded / totalBytes),
});
const table = redivis.user('user_name').dataset('dataset_name', { version: 'next' }).table('table_name');

// Arrays of row objects (and arrow Tables) are uploaded as newline-delimited JSON
await table.upload('rows').create([
  { id: 1, name: 'a' },
  { id: 2, name: 'b' },
]);
import { readdir } from 'node:fs/promises';
import path from 'node:path';

const table = redivis.user('user_name').dataset('dataset_name', { version: 'next' }).table('table_name');
const directory = '/path/to/data/directory';

for (const fileName of await readdir(directory)) {
  await table.upload().create(path.join(directory, fileName));
}

Attributes

Name
Description

name

The upload's name.

table

A reference to the Table that the upload belongs to.

properties

An object containing the API resource representation of the upload. This will only be populated after certain methods are called, particularly the get method.

Methods

Method
Description

Upload.create([content, options])

Create an upload with the provided data and/or configuration.

Delete the upload.

Upload.download([path, options])

Export the upload in a particular format and download it to disk (Node.js only).

Check whether the upload exists.

Fetch the upload, populating upload.properties.

Insert rows into an upload of type stream.

Upload.listVariables([maxResults])

List the variables of the upload.

Upload.to*([maxResults, options])

Various methods to read data out of an imported (but not yet released) upload. Mirrors the various Table.to* methods (e.g., upload.toRowsArray()).

Return a Variable within this upload.

Was this helpful?