Results of 1 - 1 of about 1 for DropBehavior (0.000 sec.)
- Import Data 9414
- Overview The Rust client offers two ways to get data into DuckDB in bulk: the high-performance Appender for inserting rows from Rust, and reading directly from data files such as Parquet, CSV, and JSON. Both are described below. Appender Th
...The following bulk-inserts ten million rows, adapted from the crate's appender example : use duckdb::{params, Connection, DropBehavior, Result}; fn main() -> Result<()> { let mut db = Connection::open_in_memory()?; db.execute_batch( "CREATE TABLE test (id I...OT NULL, active TINYINT NOT NULL)", )?; let row_count = 10_000_000; { let mut tx = db.transaction()?; tx.set_drop_behavior(DropBehavior::Commit); let mut app = tx.appender("test")?; for i in 0..row_count { app.append_row(params![i, "123456", 15, 1])?; } } //...i64>(0))?; assert_eq!(count, row_count); Ok(()) } A Transaction rolls back by default when dropped. Call set_drop_behavior(DropBehavior::Commit) to commit on drop instead, or call tx.commit() explicitly. The other DropBehavior variants are Rollback (the defa... - https://man.mtool.work/duckdb/2.0/clients/rust/data_import.html
PREV
1
NEXT
DuckDB 2.0 Documentation / man.mtool.work