import()
Restores the database from a file.
NoteWebSocket connections currently do not currently support exports and imports. Be sure to use an HTTP endpoint when using this method.
Method Syntaxdb.import(source)
use surrealdb::engine::any::connect; use surrealdb::opt::auth::Root; async fn main() -> surrealdb::Result<()> { let db = connect("http://localhost:8000").await?; db.signin(Root { username: "root", password: "root", }) .await?; db.use_ns("ns").use_db("db").await?; db.import("backup.surql").await?; Ok(()) }