-
Notifications
You must be signed in to change notification settings - Fork 30k
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
node:sqlite: support database.backup #55413
Comments
Hello @cjihrig . Would you have an opinion about this? This is something I'd like to try. Having some advice would be good. |
Seems like a useful feature to support. One design issue I see is whether we would expose the individual functions that make up the online backup API, or provide a single |
FYI, that's another reference I'm looking into https://github.com/TryGhost/node-sqlite3/blob/2f0c799398ee8937c847bb718cbc6391fdb02446/src/backup.cc |
I was wondering if we could go with the simpler approach and, if needed, expose individual functions. Even though I'm a newbie I got a minimal implementation in C and I am about to turn it into C++. For the interface, I was thinking of something like const backup = database.backup('backup-filename', {
sourceDbName: 'sourceDb', // defaults to main
targetDbName: 'targetDb', // defaults to main
}); In the beginning, I thought this could return a However, the progress of the backup might be something users want to know. So I wonder if it would be better to have Events like Another question: should this operation be cancellable? |
@topvis you should be able to use https://www.sqlite.org/lang_vacuum.html#vacuuminto not really sure how you could do this on a separate thread. there is also serialize/deserialize as an alternative to |
Thank you @billywhizz. I didn't know |
Since some methods look like those in @cjihrig, I'm struggling with knowing how to make it non-blocking. Would you happen to have any references I can look into? I think I will have to use that |
SQLite itself is synchronous. To make it async, you'll have to use the thread pool - there should be a number of examples of this in the
Given all of that, plus the fact that |
What is the problem this feature will solve?
no simple function to make backup of the sqlite database.
What is the feature you are proposing to solve the problem?
make a backup of sqlite database with a simple function like
database.backup(filename);
refer to sqlite backup API: https://www.sqlite.org/backup.html
What alternatives have you considered?
No response
The text was updated successfully, but these errors were encountered: