@@ -13,6 +13,8 @@ use pyo3_arrow::PyTable;
1313use  stac_duckdb:: Client ; 
1414use  std:: { path:: PathBuf ,  sync:: Mutex } ; 
1515
16+ const  REQUIRED_EXTENSIONS :  [ & str ;  3 ]  = [ "spatial" ,  "icu" ,  "parquet" ] ; 
17+ 
1618#[ pyclass( frozen) ]  
1719pub  struct  DuckdbClient ( Mutex < Client > ) ; 
1820
@@ -34,14 +36,16 @@ impl DuckdbClient {
3436            ) ?; 
3537        } 
3638        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+             } 
3942        } 
4043        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}" ) ,  [ ] ) ?; 
4248        } 
43-         connection. execute ( "LOAD spatial" ,  [ ] ) ?; 
44-         connection. execute ( "LOAD icu" ,  [ ] ) ?; 
4549        let  mut  client = Client :: from ( connection) ; 
4650        client. use_hive_partitioning  = use_hive_partitioning; 
4751        Ok ( DuckdbClient ( Mutex :: new ( client) ) ) 
0 commit comments