Skip to content

Commit

Permalink
Merge pull request #27 from spicehq/qianqian/rust-example
Browse files Browse the repository at this point in the history
Update Rust SDK sample
  • Loading branch information
Sevenannn authored Oct 25, 2023
2 parents 8891547 + 22c79f5 commit b6c7abd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions rust/snippets/spice-rs/main.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
use spice_rs::Client;
use futures::stream::StreamExt;
use spice_rs::*;

let mut spice_client = new_spice_client(api_key).await;
let mut spice_client = Client::new("api_key").await;

match spice_client.query(
"SELECT number, \"timestamp\", base_fee_per_gas, base_fee_per_gas / 1e9 AS base_fee_per_gas_gwei FROM eth.recent_blocks limit 10".to_string()
"SELECT number, \"timestamp\", base_fee_per_gas, base_fee_per_gas / 1e9 AS base_fee_per_gas_gwei FROM eth.recent_blocks limit 10"
).await {
Ok(mut flight_data_stream) => {
// Read back RecordBatches
// Read back RecordBatches
while let Some(batch) = flight_data_stream.next().await {
match batch {
Ok(batch) => {
Ok(batch) => {
println!("{:?}", batch);
},
Err(e) => {
assert!(false, "Error: {}", e)
assert!(false, "Error: {}", e);
},
};
}
Expand Down

0 comments on commit b6c7abd

Please sign in to comment.