@@ -13,6 +13,8 @@ use pyo3_arrow::PyTable;
13
13
use stac_duckdb:: Client ;
14
14
use std:: { path:: PathBuf , sync:: Mutex } ;
15
15
16
+ const REQUIRED_EXTENSIONS : [ & str ; 3 ] = [ "spatial" , "icu" , "parquet" ] ;
17
+
16
18
#[ pyclass( frozen) ]
17
19
pub struct DuckdbClient ( Mutex < Client > ) ;
18
20
@@ -34,14 +36,16 @@ impl DuckdbClient {
34
36
) ?;
35
37
}
36
38
if install_extensions {
37
- connection. execute ( "INSTALL spatial" , [ ] ) ?;
38
- connection. execute ( "INSTALL icu" , [ ] ) ?;
39
+ for extension in REQUIRED_EXTENSIONS {
40
+ connection. execute ( & format ! ( "INSTALL {extension}" ) , [ ] ) ?;
41
+ }
39
42
}
40
43
for extension in extensions {
41
- connection. execute ( & format ! ( "LOAD '{}'" , extension) , [ ] ) ?;
44
+ connection. execute ( & format ! ( "LOAD '{extension}'" ) , [ ] ) ?;
45
+ }
46
+ for extension in REQUIRED_EXTENSIONS {
47
+ connection. execute ( & format ! ( "LOAD {extension}" ) , [ ] ) ?;
42
48
}
43
- connection. execute ( "LOAD spatial" , [ ] ) ?;
44
- connection. execute ( "LOAD icu" , [ ] ) ?;
45
49
let mut client = Client :: from ( connection) ;
46
50
client. use_hive_partitioning = use_hive_partitioning;
47
51
Ok ( DuckdbClient ( Mutex :: new ( client) ) )
0 commit comments