question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: sanity dataset sync

See original GitHub issue

I have multiple client projects running on Sanity. I use a staging and production dataset for each, using staging for my local development. This way I can show them a staging site, using staging data, for new features or other changes.

I like to keep the staging dataset as close to production as much as possible. So, when I get to work on a new feature, I run:

sanity dataset export production && sanity dataset import production.tar.gz staging --replace && rm production.tar.gz

Now that my clients have been using Sanity for a bit, their assets have grown substantially and this command can take some time - and is also (probably) eating up our bandwidth.

I’d love to be able to do something like:

sanity dataset sync --from production --to staging

and (ideally) have it do a real ‘sync’, instead of an entire dump-and-upload.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:46
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
kmelvecommented, May 6, 2019

This is a… good idea. It’s put on the backlog 👍

2reactions
good-ideacommented, Feb 25, 2021

I made a package for syncing between datasets – it’s still a little “beta” but has been doing the trick: https://github.com/sanctuarycomputer/sanity-graph-import

You could do a complete sync by providing it with a query for all documents * (but come to think of it you may need to omit the internal document types that start with _sanity)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Datasets - Sanity.io
A dataset is a collection of JSON documents that can be of different types and have references to each other. You can think...
Read more >
Multi-environment deployments | Sanity.io guide
Finally, when we create a new branch to develop a new feature in the studio, we will create a studio deployment and a...
Read more >
Importing Data - Sanity.io
You can run sanity dataset import --help for a quick summary of syntax and options. ... Importing large data sets can quickly cause...
Read more >
Mutations - Sanity.io
The mutation API lets you create and modify documents. All requests have to be authenticated. Gotcha. Please note that validation rules ...
Read more >
Real-time Updates - Sanity.io
Listeners use the Server-Sent Events protocol, by making an HTTPS request to: https://<project-id>.api.sanity.io/v2021-06-07/data/listen/<dataset>?query=< ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found