Skip to content

Commit e59405c

Browse files
committed
feat: add extension_directory to duckdb
1 parent 1888a15 commit e59405c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

crates/duckdb/src/lib.rs

+8
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ pub struct Config {
115115

116116
/// Use a custom extension repository.
117117
pub custom_extension_repository: Option<String>,
118+
119+
/// Set the extension directory.
120+
pub extension_directory: Option<String>,
118121
}
119122

120123
/// A SQL query.
@@ -189,6 +192,7 @@ impl Client {
189192
/// use_httpfs: true,
190193
/// install_extensions: true,
191194
/// custom_extension_repository: None,
195+
/// extension_directory: None,
192196
/// };
193197
/// let client = Client::with_config(config);
194198
/// ```
@@ -200,6 +204,9 @@ impl Client {
200204
[custom_extension_repository],
201205
)?;
202206
}
207+
if let Some(ref extension_directory) = config.extension_directory {
208+
connection.execute("SET extension_directory = '?'", [extension_directory])?;
209+
}
203210
if config.install_extensions {
204211
connection.execute("INSTALL spatial", [])?;
205212
connection.execute("INSTALL icu", [])?;
@@ -564,6 +571,7 @@ impl Default for Config {
564571
use_httpfs: true,
565572
install_extensions: true,
566573
custom_extension_repository: None,
574+
extension_directory: None,
567575
}
568576
}
569577
}

0 commit comments

Comments
 (0)