Skip to content

Commit 31d177b

Browse files
committed
feat: additional read instructions added
1 parent e5ab97c commit 31d177b

File tree

1 file changed

+23
-2
lines changed
  • docs/data_engineering/data_lakehouse/delta_lake

1 file changed

+23
-2
lines changed

docs/data_engineering/data_lakehouse/delta_lake/rust.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ use deltalake::DeltaTableError;
131131

132132
// ...
133133

134-
async fn read(table_name: &str) -> Result<Vec<RecordBatch>, DeltaTableError> {
134+
async fn read_01(table_name: &str) -> Result<Vec<RecordBatch>, DeltaTableError> {
135135
let delta_ops = get_delta_ops(table_name, true).await?;
136136

137137
let (_, stream) = delta_ops.load().await?;
@@ -145,7 +145,28 @@ async fn main() {
145145
// ...
146146

147147
let table_name = "employee";
148-
let employee_records = read(&table_name).await.expect("Read failed");
148+
let employee_records = read_01(&table_name).await.expect("Read failed");
149149
println!("employee_records: {:?}", employee_records);
150150
}
151151
```
152+
153+
or
154+
155+
```rust
156+
use deltalake::{DeltaTable, DeltaTableError};
157+
158+
async fn read_02(table_path: &str) -> Result<DeltaTable, DeltaTableError> {
159+
let table = deltalake::open_table(table_path).await?;
160+
161+
Ok(table)
162+
}
163+
164+
#[tokio::main()]
165+
async fn main() {
166+
// ...
167+
168+
let table_path = "s3://data-lakehouse/employee";
169+
let table = read_02(table_path).await.expect("Read failed");
170+
println!("{:?}", table);
171+
}
172+
```

0 commit comments

Comments
 (0)