pub struct Write { /* private fields */ }Expand description
A client for BigQuery Storage Write API.
Implementations§
Source§impl Write
impl Write
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Creates a new ClientBuilder.
Sourcepub fn open_default_stream<T: Into<String>>(
&self,
table: T,
) -> WriterBuilder<DefaultStream>
pub fn open_default_stream<T: Into<String>>( &self, table: T, ) -> WriterBuilder<DefaultStream>
Opens the default stream for the given table.
table must have the format
projects/{project}/datasets/{dataset}/tables/{table}.
§Example
let writer = client
.open_default_stream("projects/my-project/datasets/my-dataset/tables/my-table")
.build_arrow(schema())
.await?;
use google_cloud_bigquery::model::ArrowSchema;
fn schema() -> ArrowSchema {
todo!("Define your table's schema...")
}Sourcepub fn create_stream<S: ApplicationCreatedStream, T: Into<String>>(
&self,
table: T,
) -> WriterBuilder<S>
pub fn create_stream<S: ApplicationCreatedStream, T: Into<String>>( &self, table: T, ) -> WriterBuilder<S>
Creates a new application-created stream for the given table.
table must have the format
projects/{project}/datasets/{dataset}/tables/{table}.
The stream type S can be inferred from the variable’s writer type
annotation
(PendingWriter,
CommittedWriter, or
BufferedWriter) or specified explicitly via turbofish
(create_stream::<PendingStream, _>(...)).
See Selecting a type for guidance on choosing a stream type for your workload.
§Example
use google_cloud_bigquery::write::PendingWriter;
use google_cloud_bigquery::write::format::Arrow;
let writer: PendingWriter<Arrow> = client
.create_stream("projects/my-project/datasets/my-dataset/tables/my-table")
.build_arrow(schema())
.await?;
use google_cloud_bigquery::model::ArrowSchema;
fn schema() -> ArrowSchema {
todo!("Define your table's schema...")
}Sourcepub fn attach_to_stream<S: ApplicationCreatedStream, T: Into<String>>(
&self,
write_stream: T,
) -> WriterBuilder<S>
pub fn attach_to_stream<S: ApplicationCreatedStream, T: Into<String>>( &self, write_stream: T, ) -> WriterBuilder<S>
Attaches a writer to an existing application-created stream.
write_stream must have the format
projects/{project}/datasets/{dataset}/tables/{table}/streams/{stream}.
The stream type S can be inferred from the variable’s writer type
annotation
(PendingWriter,
CommittedWriter, or
BufferedWriter) or specified explicitly via turbofish
(attach_to_stream::<PendingStream, _>(...)).
§Example
use google_cloud_bigquery::write::CommittedWriter;
use google_cloud_bigquery::write::format::Arrow;
let writer: CommittedWriter<Arrow> = client
.attach_to_stream("projects/my-project/datasets/my_dataset/tables/my_table/streams/my_stream")
.build_arrow(schema())
.await?;Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Write
impl !UnwindSafe for Write
impl Freeze for Write
impl Send for Write
impl Sync for Write
impl Unpin for Write
impl UnsafeUnpin for Write
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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>
T in a tonic::Request