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

Reload data from database #386

Open
Sesa1988 opened this issue Aug 16, 2024 · 3 comments
Open

Reload data from database #386

Sesa1988 opened this issue Aug 16, 2024 · 3 comments

Comments

@Sesa1988
Copy link

Hi,

is there a way to reload all data from the database file?

I copy a remote file via my app and want to display the new data but I cant find a way without restarting my app.

@alextekartik
Copy link
Collaborator

Internally there is one but it is not exposed as it is not safe (i.e. what happens if there is a transaction while the copy is in progress)

A safer way would be to:

  1. close the db
  2. copy the file
  3. open the db

Another (even safer) solution would be to use an export. You can even generate an export from a database file (by opening it and exporting it). More info here: https://github.com/tekartik/sembast.dart/blob/master/sembast/doc/storage_format.md#importexport

@alextekartik
Copy link
Collaborator

I have added Database.reload() (that i consider as experimental) in sembast 3.7.3 just published. Let me know if it works

@Sesa1988
Copy link
Author

I have added Database.reload() (that i consider as experimental) in sembast 3.7.3 just published. Let me know if it works

Thanks! I will implement it for my next release and let you know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants