Struct google_cloud_bigquery::client::Client
source · pub struct Client { /* private fields */ }Implementations§
source§impl Client
impl Client
sourcepub async fn new(config: ClientConfig) -> Result<Self, Error>
pub async fn new(config: ClientConfig) -> Result<Self, Error>
New client
sourcepub fn dataset(&self) -> &BigqueryDatasetClient
pub fn dataset(&self) -> &BigqueryDatasetClient
https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets BigqueryDatasetClient
sourcepub fn table(&self) -> &BigqueryTableClient
pub fn table(&self) -> &BigqueryTableClient
https://cloud.google.com/bigquery/docs/reference/rest/v2/tables BigqueryTableClient
sourcepub fn tabledata(&self) -> &BigqueryTabledataClient
pub fn tabledata(&self) -> &BigqueryTabledataClient
https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata BigqueryTabledataClient
sourcepub fn job(&self) -> &BigqueryJobClient
pub fn job(&self) -> &BigqueryJobClient
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs BigqueryJobClient
sourcepub fn routine(&self) -> &BigqueryRoutineClient
pub fn routine(&self) -> &BigqueryRoutineClient
https://cloud.google.com/bigquery/docs/reference/rest/v2/routines BigqueryRoutineClient
sourcepub fn row_access_policy(&self) -> &BigqueryRowAccessPolicyClient
pub fn row_access_policy(&self) -> &BigqueryRowAccessPolicyClient
https://cloud.google.com/bigquery/docs/reference/rest/v2/rowAccessPolicy BigqueryRowAccessPolicyClient
sourcepub fn model(&self) -> &BigqueryModelClient
pub fn model(&self) -> &BigqueryModelClient
https://cloud.google.com/bigquery/docs/reference/rest/v2/models BigqueryModelClient
sourcepub async fn query<T>(
&self,
project_id: &str,
request: QueryRequest
) -> Result<Iterator<T>, QueryError>where
T: StructDecodable + StructDecodable,
pub async fn query<T>(
&self,
project_id: &str,
request: QueryRequest
) -> Result<Iterator<T>, QueryError>where
T: StructDecodable + StructDecodable,
Run query job and get result.
use google_cloud_bigquery::http::job::query::QueryRequest;
use google_cloud_bigquery::query::row::Row;
use google_cloud_bigquery::client::Client;
async fn run(client: &Client, project_id: &str) {
let request = QueryRequest {
query: "SELECT * FROM dataset.table".to_string(),
..Default::default()
};
let mut iter = client.query::<Row>(project_id, request).await.unwrap();
while let Some(row) = iter.next().await.unwrap() {
let col1 = row.column::<String>(0);
let col2 = row.column::<Option<String>>(1);
}
}sourcepub async fn query_with_option<T>(
&self,
project_id: &str,
request: QueryRequest,
option: QueryOption
) -> Result<Iterator<T>, QueryError>where
T: StructDecodable + StructDecodable,
pub async fn query_with_option<T>(
&self,
project_id: &str,
request: QueryRequest,
option: QueryOption
) -> Result<Iterator<T>, QueryError>where
T: StructDecodable + StructDecodable,
Run query job and get result.
use google_cloud_bigquery::http::job::query::QueryRequest;
use google_cloud_bigquery::query::row::Row;
use google_cloud_bigquery::client::Client;
use google_cloud_bigquery::query::QueryOption;
use google_cloud_bigquery::query::ExponentialBuilder;
async fn run(client: &Client, project_id: &str) {
let request = QueryRequest {
query: "SELECT * FROM dataset.table".to_string(),
..Default::default()
};
let retry = ExponentialBuilder::default().with_max_times(10);
let option = QueryOption::default().with_retry(retry).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);
}
}sourcepub async fn read_table<T>(
&self,
table: &TableReference,
option: Option<ReadTableOption>
) -> Result<Iterator<T>, Error>where
T: StructDecodable,
pub async fn read_table<T>(
&self,
table: &TableReference,
option: Option<ReadTableOption>
) -> Result<Iterator<T>, Error>where
T: StructDecodable,
Read table data by BigQuery Storage Read API.
use google_cloud_bigquery::storage::row::Row;
use google_cloud_bigquery::client::Client;
use google_cloud_bigquery::http::table::TableReference;
async fn run(client: &Client, project_id: &str) {
let table = TableReference {
project_id: project_id.to_string(),
dataset_id: "dataset".to_string(),
table_id: "table".to_string(),
};
let mut iter = client.read_table::<Row>(&table, None).await.unwrap();
while let Some(row) = iter.next().await.unwrap() {
let col1 = row.column::<String>(0);
let col2 = row.column::<Option<String>>(1);
}
}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request