Skip to content

Commit ce5684e

Browse files
committed
Document Appender thread safety constraints
1 parent 85543ad commit ce5684e

File tree

1 file changed

+13
-0
lines changed
  • crates/duckdb/src/appender

1 file changed

+13
-0
lines changed

crates/duckdb/src/appender/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@ use crate::{
88
};
99

1010
/// Appender for fast import data
11+
///
12+
/// # Thread Safety
13+
///
14+
/// `Appender` is neither `Send` nor `Sync`:
15+
/// - Not `Send` because it holds a reference to `Connection`, which is `!Sync`
16+
/// - Not `Sync` because DuckDB appenders don't support concurrent access
17+
///
18+
/// To use an appender in another thread, move the `Connection` to that thread
19+
/// and create the appender there.
20+
///
21+
/// If you need to share an `Appender` across threads, wrap it in a `Mutex`.
22+
///
23+
/// See [DuckDB concurrency documentation](https://duckdb.org/docs/stable/connect/concurrency.html) for more details.
1124
pub struct Appender<'conn> {
1225
conn: &'conn Connection,
1326
app: ffi::duckdb_appender,

0 commit comments

Comments
 (0)