1- // Copyright 2020 Google LLC
1+ // Copyright 2021 Google LLC
22//
33// Licensed under the Apache License, Version 2.0 (the "License");
44// you may not use this file except in compliance with the License.
@@ -50,13 +50,19 @@ message CreateWriteStreamRequest {
5050//
5151// The Write API can be used to write data to BigQuery.
5252service BigQueryWrite {
53+ option deprecated = true ;
5354 option (google.api.default_host ) = "bigquerystorage.googleapis.com" ;
5455 option (google.api.oauth_scopes ) =
5556 "https://www.googleapis.com/auth/bigquery,"
5657 "https://www.googleapis.com/auth/bigquery.insertdata,"
5758 "https://www.googleapis.com/auth/cloud-platform" ;
5859
5960 // Creates a write stream to the given table.
61+ // Additionally, every table has a special COMMITTED stream named '_default'
62+ // to which data can be written. This stream doesn't need to be created using
63+ // CreateWriteStream. It is a stream that can be used simultaneously by any
64+ // number of clients. Data written to this stream is considered committed as
65+ // soon as an acknowledgement is received.
6066 rpc CreateWriteStream (CreateWriteStreamRequest ) returns (WriteStream ) {
6167 option (google.api.http ) = {
6268 post : "/v1alpha2/{parent=projects/*/datasets/*/tables/*}"
@@ -102,7 +108,7 @@ service BigQueryWrite {
102108 }
103109
104110 // Finalize a write stream so that no new data can be appended to the
105- // stream.
111+ // stream. Finalize is not supported on the '_default' stream.
106112 rpc FinalizeWriteStream (FinalizeWriteStreamRequest ) returns (FinalizeWriteStreamResponse ) {
107113 option (google.api.http ) = {
108114 post : "/v1alpha2/{name=projects/*/datasets/*/tables/*/streams/*}"
@@ -128,6 +134,7 @@ service BigQueryWrite {
128134 // required in order for the rows to become available for reading. A
129135 // Flush operation flushes up to any previously flushed offset in a BUFFERED
130136 // stream, to the offset specified in the request.
137+ // Flush is not supported on the _default stream, since it is not BUFFERED.
131138 rpc FlushRows (FlushRowsRequest ) returns (FlushRowsResponse ) {
132139 option (google.api.http ) = {
133140 post : "/v1alpha2/{write_stream=projects/*/datasets/*/tables/*/streams/*}"
@@ -150,6 +157,8 @@ message AppendRowsRequest {
150157 // Required. The stream that is the target of the append operation. This value must be
151158 // specified for the initial request. If subsequent requests specify the
152159 // stream name, it must equal to the value provided in the first request.
160+ // To write to the _default stream, populate this field with a string in the
161+ // format `projects/{project}/datasets/{dataset}/tables/{table}/_default`.
153162 string write_stream = 1 [
154163 (google.api.field_behavior ) = REQUIRED ,
155164 (google.api.resource_reference ) = {
@@ -159,7 +168,8 @@ message AppendRowsRequest {
159168
160169 // Optional. If present, the write is only performed if the next append offset is same
161170 // as the provided value. If not present, the write is performed at the
162- // current end of stream.
171+ // current end of stream. Specifying a value for this field is not allowed
172+ // when calling AppendRows for the '_default' stream.
163173 google.protobuf.Int64Value offset = 2 [(google.api.field_behavior ) = OPTIONAL ];
164174
165175 // Input rows. The `writer_schema` field must be specified at the initial
@@ -183,7 +193,18 @@ message AppendRowsResponse {
183193 int64 offset = 1 ;
184194
185195 // Error in case of append failure. If set, it means rows are not accepted
186- // into the system. Users can retry within the same connection.
196+ // into the system. Users can retry or continue with other requests within
197+ // the same connection.
198+ // ALREADY_EXISTS: happens when offset is specified, it means the row is
199+ // already appended, it is safe to ignore this error.
200+ // OUT_OF_RANGE: happens when offset is specified, it means the specified
201+ // offset is beyond the end of the stream.
202+ // INVALID_ARGUMENT: error caused by malformed request or data.
203+ // RESOURCE_EXHAUSTED: request rejected due to throttling. Only happens when
204+ // append without offset.
205+ // ABORTED: request processing is aborted because of prior failures, request
206+ // can be retried if previous failure is fixed.
207+ // INTERNAL: server side errors that can be retried.
187208 google.rpc.Status error = 2 ;
188209 }
189210
0 commit comments