Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SurrealQL statements for backup/restore and import/export #30

Open
2 tasks done
ansarizafar opened this issue Aug 11, 2022 · 4 comments
Open
2 tasks done

SurrealQL statements for backup/restore and import/export #30

ansarizafar opened this issue Aug 11, 2022 · 4 comments
Labels
feature New feature or request topic:surrealql This is related to the SurrealQL query language

Comments

@ansarizafar
Copy link

ansarizafar commented Aug 11, 2022

Is your feature request related to a problem?

Currently we can only perform Backup/Restore and Import/Export with CLI and There is no way to initiate these task with SurrealQL.

Describe the solution

I suggest adding SurrealQL statements for performing backup/restore and import/export data.

BACKUP INTO '{collectionURI}';
RESTORE DATABASE bank FROM LATEST IN '{collectionURI}';
RESTORE TABLE bank.customers FROM LATEST IN '{collectionURI}';

Reference: https://www.cockroachlabs.com/docs/stable/backup.html

These statements will enable us to initiate and schedule backup/restore from code.

Alternative methods

CLI can be used to perform backup/restore.

SurrealDB version

v1.0.0-beta.4

Contact Details

No response

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@tobiemh tobiemh added the feature New feature or request label Aug 11, 2022
@ntorrey
Copy link

ntorrey commented Oct 15, 2022

I was just about to add a feature request for this until I hit the checkbox labeled "I have searched the existing issues"!
This would greatly simplify my life. I've already spent a couple of hours trying to figure out how to download the data file from my fly.io instance of SurrealDB. I suppose each use case will differ in the approach to actually downloading the data, which is why a Surreal SQL statement would make the process simple and consistent for everyone.

@ntorrey
Copy link

ntorrey commented Nov 12, 2022

EDIT: See comment below for a much better way

I couldn't wait any longer for this feature so I just rolled my own!
https://gist.github.com/ntorrey/465210e29dbf0dd9ed274a651d79f2cd

@ntorrey
Copy link

ntorrey commented Apr 18, 2023

@tobiemh Sorry to ping you on this, but just wanted to make sure this feature request is not forgotten! I use Google's firebase functions to automatically make backups of my database to firebase storage (with a custom backup script that basically loops through all the records in my database - not great performance-wise but is fine for my use-case). Since they are run from a node environment it sure would be useful if I could actually retrieve the export file via the JavaScript library. I suppose this would be useful for others too who are looking for similar functionality? Or maybe @kearfy would be the one to ask about the js library? Thanks!

@ntorrey
Copy link

ntorrey commented Jun 7, 2023

Silly me - this functionality is already possible for me using the /export and /import REST endpoints! Not sure why I didn't think of this before.
In any case, I think this feature would still be useful.
If anyone else is using firebase functions and wants to know how I scheduled regular backups and got imports working, just ping me.

@kearfy kearfy added the topic:surrealql This is related to the SurrealQL query language label Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request topic:surrealql This is related to the SurrealQL query language
Projects
None yet
Development

No branches or pull requests

4 participants