bigquery 0.10.0

Library provides a simple API for Google BigQuery based on the gRPC Storage Read/Write and v2 APIs
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! [`BigQueryTableSupport`] for [`BigQueryDb`]: one `GetTable` per lookup.

use crate::{BigQueryDb, BigQueryResult, BigQueryTableRef, BigQueryTableSupport};
use async_trait::async_trait;

#[async_trait]
impl BigQueryTableSupport for BigQueryDb {
    async fn primary_key_columns(&self, table: &BigQueryTableRef) -> BigQueryResult<Vec<String>> {
        Ok(self
            .get_table_body(table)
            .await?
            .table_constraints
            .and_then(|constraints| constraints.primary_key)
            .map(|key| key.columns)
            .unwrap_or_default())
    }
}