Dataset
class Dataset
Datasets are a core entity on Redivis, and all data uploaded to Redivis must belong to a dataset. Datasets are owned by a user or organization, and contain one or more tables, organized into versions. Various methods allow you to construct the tables and queries within a dataset, as well as to create, update, version, and release datasets.
Constructors
redivis.dataset(name[, options])
Return a Dataset, given its qualified reference (e.g., demo.iris_species), or its name within the default user or organization.
Organization.dataset(name[, options])
Return a Dataset owned by an organization.
User.dataset(name[, options])
Return a Dataset owned by a user.
Organization.listDatasets([maxResults, options])
List the Datasets owned by an organization.
User.listDatasets([maxResults])
List the Datasets owned by a user.
The dataset's name may include a reference id and version tag, following the resource reference syntax (e.g., us_forest_service_fires:5k9t:v1_1). The version can also be provided via the version option (e.g., { version: 'next' }). If no version is specified, the dataset refers to its current (latest released) version.
Examples
const dataset = redivis.organization('demo').dataset('iris_species');
await dataset.exists(); // -> true
await dataset.get(); // dataset.properties is now populated with the dataset resource definition
dataset.table('iris'); // -> Returns a Table
dataset.query('SELECT * FROM iris'); // -> Returns a Query, scoped to the dataset
await dataset.listTables(); // -> Returns an array of Tables// Could also create a dataset under an organization:
// const dataset = redivis.organization('my_organization').dataset('some_dataset');
const dataset = redivis.user('your_username').dataset('some_dataset');
// publicAccessLevel can be one of 'none', 'overview', 'metadata', 'sample', 'data'
await dataset.create({ publicAccessLevel: 'overview', description: 'Some description' });const dataset = redivis.user('your_username').dataset('some_dataset');
// Returns the dataset at its next version, creating it unless it already exists
const nextVersion = await dataset.createNextVersion({ ifNotExists: true });
await nextVersion.table('my_table').upload().create('./data.csv');
await nextVersion.release({ releaseNotes: 'Added data for 2024' });Attributes
name
The dataset's name.
organization
A reference to the Organization that owns the dataset. Will be undefined if the dataset is owned by a user.
user
A reference to the User that owns the dataset. Will be undefined if the dataset is owned by an organization.
versionTag
The tag of the version that the dataset refers to (e.g., v1_0, or next), if one was specified or the dataset has been fetched.
properties
An object containing the API resource representation of the dataset. 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 dataset, e.g. demo.us_forest_service_fires:5k9t:v1_1
scopedReference
The canonical reference for the dataset, without its owner, e.g. us_forest_service_fires:5k9t:v1_1
Methods
Dataset.create([options])
Create a new dataset.
Dataset.createNextVersion([options])
Create the next (unreleased) version of the dataset, and return the dataset at that version.
Delete the dataset.
Check whether the dataset exists.
Fetch the dataset's metadata, populating dataset.properties.
Dataset.listTables([maxResults])
List the dataset's Tables.
Dataset.listVersions([maxResults])
List the dataset's Versions.
Return the dataset at the version after this one, if any.
Return the dataset at the version before this one, if any.
Dataset.query(query)
Return a Query scoped to the dataset.
Dataset.release([options])
Release the next version of the dataset.
Dataset.table(name)
Return a Table within the dataset.
Unrelease the current version of the dataset.
Dataset.update(options)
Update the dataset's metadata.
Dataset.updateVariables(variables)
Batch update variable metadata across the dataset's tables.
Dataset.version([tag])
Return a Version of the dataset.
Was this helpful?

