Support for `convex import` from a snapshot export?
When I try to use
convex import
to restore a table snapshot I just downloaded, I get this error:
Adding --append
doesn't help. I'm using Convex 0.12.27 Replies
Hi! Sorry about the error, we see it on our side and will fix it soon. The issue is your data includes
_id
and _creationTime
fields which cannot be imported. As a workaround, you could process the data (with python or node) to remove those fields.Oof but that makes sense. Is there a different way to backup and restore data from the DB?
There isn't a turnkey backup and restore at the moment. A backups feature has been discussed but not started. We're working on some improvements that will make it possible to do correctly, though.
There is one thing I've been toying with the idea of, which I'd be interested in your feedback on:
A script that turns a snapshot export (dir of JSON files) into a seed script, so you can take a deployment's data and make code to bootstrap a new dev deployment, in CI, etc.
It would do inserts in batches, and may need to write documents with old ID references and patch them later with the new IDs, so this would mean the data would be inconsistent until the seeding is done. This is fine for a new dev deployment, but is risky for a prod deployment where you'd want transactional guarantees. (which is ultimately why we don't offer the snapshot import by default)
I'd publish this code in a repo for folks to use / vendor in. Then you can adjust it if you want different behavior
@ian is is possible to export a snapshot from dev and import it into prod?
@Gorka Cesium that is possible now, yes (this is a very old thread)
cool, that will save me time with the migration to prod