Finding and managing datasets in Sanity.io

4 replies
Last updated: Jun 5, 2023
Hello everyoneCan we see what dataset are we using in sanity desk?
AI Update

Yes! There are a few ways to see which dataset you're currently using in Sanity Studio:

1. In the Studio UI itself

The easiest way is to look at the top-right corner of your Studio interface. You'll typically see your project information displayed there, which includes the dataset name you're currently working with.

2. Check your Studio configuration file

Open your sanity.config.js (or .ts) file in your Studio project. You'll see the dataset specified in the defineConfig function:

export default defineConfig({
  projectId: 'your-project-id',
  dataset: 'production', // ← This is your current dataset
  // other configuration
})

3. Check environment variables

If your Studio uses environment variables, check your .env.development or .env.production files for:

SANITY_STUDIO_API_DATASET=your-dataset-name

4. Using the Sanity CLI

You can list all datasets in your project using the CLI command:

sanity dataset list

This will show all available datasets for your project, though it won't specifically highlight which one your Studio is currently using (you'll need to cross-reference with your config for that).

5. In the browser console

If you're already in Studio, you can open your browser's developer console and type:

window.location.href

Some Studio setups include the dataset in the URL, making it visible in your browser's address bar.

The configuration file method (#2) is usually the most reliable way to confirm which dataset your Studio is pointing to, since that's the source of truth for your Studio's connection settings.

Not directly in the desk.
You would have to go to your profile in the top right > Manage project > (this brings you to the project overview and > Datasets

Additionally, in your code, you can go to
sanity.json
(v2) or
sanity.config.js
and your projectID and dataset are listed there
Thank you for the replyMy concern is that if I have 2 similar datasets for qa and production, how would the user know which dataset they are altering in the studio. (Suppose the user is not a technical person and does not know about the configs and only about the UI).
I believe it will be based on the dataset you used when using
sanity deploy
The user in the UI will have no way of switching it from there.

When I'm doing QA I use two different Sanity studios and copy the data once confirmed
Great! Thank you for the help

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?