Skip to main content
The Narrative SDK provides comprehensive methods for managing datasets programmatically. This guide covers common dataset operations and patterns.

Prerequisites

  • SDK installed and configured (see SDK Quickstart)
  • An API key with dataset permissions

Listing datasets

Retrieve all datasets accessible to your account:

Getting dataset details

Retrieve details for a specific dataset by ID:

Dataset properties

Creating a dataset

Create a new dataset with schema definition:

Schema property types

Updating a dataset

Update dataset metadata:

Managing tags

Add tags to a dataset:
Remove tags from a dataset:

Getting dataset statistics

Retrieve summary statistics:
Get column-level statistics:

Dataset summary

Get a summary with sample data:

Sampling data

Sampling provides a preview of dataset records without downloading the full dataset. When you run an interactive query, results are stored as a dataset in your data plane. To view these results in the UI or API, a sample job retrieves up to 1,000 rows and stores them in the control plane for quick access.
Samples are one of the few cases where actual data leaves your data plane. For governance implications, see Sample Data.
Samples are useful for:
  • Viewing query results — See what your query returned without downloading everything
  • Validating data — Check data quality before sharing with partners
  • Quick inspection — Preview dataset contents during development
Request a sample of records:
Delete a sample:

Working with files

List files in a dataset:
Get a download URL for a specific file:

Materialized views

Refresh a materialized view:
Create a refresh schedule:
Update a refresh schedule:
Delete a refresh schedule:

Retention policy

Update the retention policy:

Activating a dataset

Activate a pending dataset:

Deleting a dataset

Deleting a dataset is permanent and cannot be undone. Ensure you have backups if needed.

Error handling

Uploading Data

Upload files to datasets

Executing Queries

Query dataset data

API Modules Reference

Complete API documentation