We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 43e95cc commit 79ed15aCopy full SHA for 79ed15a
crates/duckdb/examples/parquet.rs
@@ -1,15 +1,23 @@
1
+use std::path::PathBuf;
2
+
3
use duckdb::{
4
arrow::{record_batch::RecordBatch, util::pretty::print_batches},
5
Connection, Result,
6
};
7
8
fn main() -> Result<()> {
9
let db = Connection::open_in_memory()?;
10
11
db.execute_batch("INSTALL parquet; LOAD parquet;")?;
12
13
+ let parquet_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("examples/int32_decimal.parquet");
14
15
let rbs: Vec<RecordBatch> = db
- .prepare("SELECT * FROM read_parquet('./examples/int32_decimal.parquet');")?
- .query_arrow([])?
16
+ .prepare("SELECT * FROM read_parquet(?)")?
17
+ .query_arrow([parquet_path.to_string_lossy()])?
18
.collect();
19
20
assert!(print_batches(&rbs).is_ok());
21
22
Ok(())
23
}
0 commit comments