Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Rust SDK sample #27

Merged
merged 3 commits into from
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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