Managing multiple datasets within a project

A Sanity project can contain any number of datasets, each with separate data. You will be asked to name your first dataset when running sanity init, and must supply the dataset name when running queries, e.g.:


You can also specify which dataset to use with the client libraries and Sanity Studio.

Enterprise Feature

Enterprise users with the custom access control feature can set custom access control rules for each dataset. Users on regular plans can define public or private visiblity mode for their datasets.

Datasets can be created and managed using the sanity command-line tool, e.g. by running sanity dataset create <name> or sanity dataset list. To see all dataset-related subcommands, run sanity dataset.

Datasets can also be created and deleted in the project's management console, under the "Datasets" tab.

A dataset name may have a minimum length of 1 character, and a maximum length of 20 characters. It may only contain the lowercase characters a-z, the numbers 0-9, the "-" (hyphen) and the "_" (underscore) characters. Also, a dataset name must begin with a letter or number (a-z or 0-9).

Was this article helpful?