yoshidan / google-cloud-rust

Google Cloud Client Libraries for Rust.
MIT License
243 stars 87 forks source link

bigquery: Support storage api for query #184

Closed yoshidan closed 1 year ago

yoshidan commented 1 year ago

QueryOption::default().with_enable_storage_read(true) enables storage read API for query.

177

async fn run(client: &Client, project_id: &str) {
    let request = QueryRequest {
             query: "SELECT * FROM dataset.table".to_string(),
            ..Default::default()
    };
    let option = QueryOption::default().with_enable_storage_read(true);
    let mut iter = client.query_with_option::<Row>(project_id, request, option).await.unwrap();
     while let Some(row) = iter.next().await.unwrap() {
         let col1 = row.column::<String>(0);
         let col2 = row.column::<Option<String>>(1);
     }
}