Structured Content 2022: Join our conference to explore fresh perspectives on content and digital experiences →
Skip to content
Sanity
Get started
  • Sanity Studio - Flexible editing environment
  • Content Lake - Real-time database
  • Developer experience - Tooling you love
  • Structured content - The philosophy behind Sanity
  • Review changes - View edits & rollback instantly
  • Image pipeline - On-demand transformations
  • E-commerce - Better shopping experiences
  • Marketing sites - Control your story
  • Products & services - Innovate and automate
  • Mobile apps - Content backend for every OS
  • Morning Brew - Omnichannel media distribution
  • InVision - Delivering exceptional customer experiences
  • DataStax - Personalization for global audience
  • Cloudflare - Flexible modeling for a global CDN
  • React
  • Gatsby
  • Next
  • Nuxt
  • Eleventy
  • Netlify
  • Vercel
  • Algolia
  • Documentation
  • Reference
  • Guides
  • Tools & plugins
  • Project showcase
  • Schemas & snippets
  • Technology partners
  • Get support
  • Share your work
  • Migrating the Netlify Blog from Hugo to Eleventy using Sanity
PricingContact salesLog inGet started
NEWS · December 9th 2020

Supercharge your dataset workflow with Advanced Dataset Management

We have introduced two new Advanced Dataset Management features for projects on the enterprise plan. You can now initiate dataset copying directly in the cloud and create aliases to hot swap between datasets.

Bryan Robinson

Bryan used to be a Developer Relations Specialist at Sanity.

Larger projects come with more sophisticated needs for continuous integration and handling of datasets. That's why we've created a set of tools to make this process more streamlined. We call these tools Advanced Dataset Management, and they're available today for enterprise customers.

Advanced Dataset Management launches with two new features: Cloud Clone and Dataset Hotswap. With these two features, much of the manual workflow with exports and imports can be automated away.

Hands-off dataset copying with Cloud Clone

Instead of manually exporting and then importing datasets, you can now run a CLI command or hit an HTTP API endpoint to clone a dataset directly in the Sanity infrastructure. This is perfect for testing data in Continuous Integration flows, testing migrations, or working from an up-to-date dataset for new feature development.

To run via the CLI, a new subcommand has been added to the sanity dataset command structure.

# Run from within a configured Sanity project
# Copy's first argument is the dataset to copy
# The second argument is the name of a new dataset to be created
sanity dataset copy production newDataset

By default the copy command will run the copy synchronously so that you can monitor the process, but if you're running it as part of a CI process, you can use the --detach flag to run it in the background.

Cloning can also be initiated and monitored via the HTTP API by sending a request to specific endpoints.

curl --location --request PUT 'https://api.sanity.io/v1/projects/<project-id>/datasets/<dataset-name>/copy' \
  -H 'Authorization: Bearer <token-here>' \
  -H 'Content-Type: application/json' \
  --data-raw '{
    "targetDataset": "production-copy"
  }'

For full usage, read the documentation for Cloud Clone.

Create aliases for datasets and Hot Swap what they reference on the fly

Dataset Hot Swapping allows a codebase to reference a single, named entity, which can then point to different datasets depending on the need of the project.

This feature is great for projects that need to make large amounts of edits to a dataset and put all those changes live at one time without making any changes to the front-end code.

The feature is included in the Sanity CLI as a subcommand of the sanity dataset command. With a series of commands, a developer can create an alias, link it to a dataset, and then when a new dataset is needed, hot swap the underlying dataset that the alias references.

# Create a new alias
sanity dataset alias create <new-alias> <dataset-to-alias>

# Change what dataset an alias points to
sanity dataset alias link <alias-to-point> <dataset-to-point-to>

Read up on all the Hot Swap commands and details in the official documentation.

Upgrade the Sanity CLI

If your project is on an enterprise plan, you can upgrade your Sanity CLI to take advantage of these powerful new features.

# Upgrade the Sanity CLI
npm install -g @sanity/cli

# Upgrade your project
sanity upgrade

These tools are only available on Enterprise plans. If your project needs Advanced Dataset Management, reach out to find out how to upgrade your plan.

Page content

  • Hands-off dataset copying with Cloud Clone
  • Create aliases for datasets and Hot Swap what they reference on the fly
  • Upgrade the Sanity CLI

Platform

Structured ContentDeveloper experienceContent LakeSanity StudioSecurity & Compliance

Resources

Documentation
  • Content Modeling
  • React Blog
  • Gatsby Blog
  • Next.js Landing Pages
  • Progressive Web Application
  • Single Page Application
  • Svelte & Typescript App
  • Vue & Tailwind Blog
  • Developer Portfolio Templates
  • Form validation with Yup
  • Live Preview with Next.js and Sanity.io
  • React Starters
  • Next.js Starters
  • Next.js Landing Pages
  • Next.js E-commerce
  • Gatsby Starters
  • Gatsby Plugins
  • Developer Portfolio Templates
Case Studies
  • Headless CMS
  • Digital Experience Platform
  • Static Site Generator
  • Localization
  • GraphQL vs REST
  • React CMS
  • Next.JS CMS
  • Gatsby CMS
  • Node CMS
  • E-commerce CMS
  • Vue CMS
  • Angular CMS
  • GraphQL CMS
  • Newspaper CMS
  • Magazine CMS

Company

Contact SalesEnterpriseCareersTerms of Service

Stay connected

  • Github
  • Slack
  • Twitter
  • YouTube
  • Stack Overflow
  • Blog RSS

Subscribe to our newsletter

©Sanity 2022