Reference
The redivis module provides an interface to construct representations of Redivis entities and to create, modify, read, and delete them.
Resources are generally constructed by chaining together multiple constructor methods, reflecting the hierarchical nature of entities in Redivis. For example, to list all variables on a table (which belongs to a dataset in an organization), we would write:
import redivis from 'redivis';
const variables = await redivis
.organization('demo') // Returns an instance of an Organization
.dataset('cms_2014_medicare_data') // Returns an instance of a Dataset
.table('home_health_agencies') // Returns an instance of a Table
.listVariables(); // Returns a promise of an array of Variable instancesInterfaces
The redivis module. Provides constructor methods for most of the other classes, as well as authentication and configuration.
A Redivis dataset. Provides constructor methods for Tables and Queries scoped to a given dataset, as well as methods for creating, deleting, updating, and releasing datasets.
A dataset or workflow that's a source of a workflow.
A directory of non-tabular files, built from a file index table.
A non-tabular file on Redivis.
A member of an organization.
A notebook within a workflow.
A Redivis organization. Provides constructor methods for Datasets, Workflows, Members, and Secrets scoped to a given organization.
A parameter within a workflow.
A SQL query that references tables on Redivis.
One stream of a parallelized read of a table, query, or upload.
A secret belonging to a user or organization.
A Redivis table. Numerous methods are available for reading data from the table, as well as uploading data and metadata.
A transform within a workflow.
A tabular data upload on a Table.
A Redivis user. Provides constructor methods for Datasets, Workflows, and Secrets scoped to a given user.
A variable (column) of a Table, Query, or Upload.
A version of a Dataset.
A Redivis workflow. Provides constructor methods for Tables, Queries, Transforms, Notebooks, Parameters, and Datasources scoped to a given workflow.
Conventions
Arguments
Every method takes its main arguments positionally, followed by an optional object of options. Any positional argument can also be passed by name within the options, so the following are equivalent:
Unknown options throw a ValueError, rather than being silently ignored.
Asynchronous methods
Methods that call the Redivis API return promises, and should be awaited. Methods that only construct another object (e.g., dataset.table(name)) are synchronous, as are methods that return a stream or iterator (e.g., table.toArrowBatchIterator()), since these don't make any requests until they are consumed.
Properties
Each instance has a properties attribute, containing the API resource representation of the resource. It's populated whenever the resource is fetched (via get()), created, updated, or listed. A single property can also be read with getProperty(name), and JSON.stringify(instance) serializes its properties.
Progress and cancellation
Long-running methods (reading data, uploading, downloading, and waiting on jobs) accept an onProgress callback, which is called with the progress so far, and an AbortSignal as signal, which cancels the operation:
Environment variables
In Node.js, the following environment variables may be set to modify the behavior of the redivis client. Except for REDIVIS_API_TOKEN, each can also be set at runtime (in Node.js or the browser) via redivis.config(), which takes precedence over the environment variable. Options passed directly to a method take precedence over both.
Environment variable
redivis.config() option
Default
REDIVIS_DEFAULT_WORKFLOW
defaultWorkflow
REDIVIS_DEFAULT_DATASET
defaultDataset
REDIVIS_DEFAULT_USER
defaultUser
REDIVIS_DEFAULT_ORGANIZATION
defaultOrganization
REDIVIS_API_ENDPOINT
apiEndpoint
https://redivis.com/api/v1
REDIVIS_CONFIG_DIR
configDir
~/.redivis
REDIVIS_MAX_PARALLELIZATION
maxParallelization
Varies by method
REDIVIS_API_TOKEN
An API token to authenticate with, rather than logging in interactively. See Getting started.
REDIVIS_DEFAULT_WORKFLOW
If set, tables referenced via redivis.table() and unqualified table names in redivis.query() will be assumed to be within the default workflow, as will parameters, transforms, notebooks, and datasources referenced by name.
Takes the form owner_name.workflow_name. Learn more about referencing resources >
REDIVIS_DEFAULT_DATASET
If set, tables referenced via redivis.table() and unqualified table names in redivis.query() will be assumed to be within the default dataset.
Takes the form owner_name.dataset_name. If both a default dataset and workflow are set, the default workflow will supersede the dataset. Learn more about referencing resources >
REDIVIS_DEFAULT_USER
If set, datasets and workflows referenced via redivis.dataset() and redivis.workflow() without an owner (e.g., redivis.dataset('my_dataset')) will be assumed to belong to this user.
REDIVIS_DEFAULT_ORGANIZATION
If set, datasets and workflows referenced without an owner will be assumed to belong to this organization. If both a default user and organization are set, the default user will supersede the organization.
REDIVIS_API_ENDPOINT
The base URL of the Redivis API. Defaults to https://redivis.com/api/v1.
REDIVIS_CONFIG_DIR
The directory in which credentials are cached after logging in, in Node.js. Defaults to ~/.redivis. Credentials for redivis.com are cached directly in this directory, and those for any other API endpoint in a subdirectory for its host (e.g., environments/localhost_8080/), so that logging in to another environment never replaces your credentials for redivis.com.
REDIVIS_MAX_PARALLELIZATION
The default for the maxParallelization option of methods that read data, upload files, or download files. When not set, each method uses its own default. Reads are always limited to at most 8 parallel streams.
Data types
When reading data from a table, query, or upload, it is returned as Apache Arrow data (via toArrowTable() or toArrowBatchIterator()), or as plain JavaScript objects (via toRowsArray()). Each Redivis type is represented as follows:
Integer
Int64
number (or bigint, with { bigInt: true })
Float
Float64
number
Boolean
Bool
boolean
String
Utf8
string
Date
DateDay
Temporal.PlainDate (or a Date at midnight UTC, with { temporal: false })
DateTime
Timestamp (microseconds)
Temporal.PlainDateTime (or a Date in UTC, with { temporal: false })
Time
Time (microseconds)
Temporal.PlainTime (or a HH:MM:SS[.ffffff] string, with { temporal: false })
Null values are always returned as null.
Last updated
Was this helpful?

