storage.proto 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. // Copyright 2022 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.bigquery.storage.v1;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/cloud/bigquery/storage/v1/arrow.proto";
  21. import "google/cloud/bigquery/storage/v1/avro.proto";
  22. import "google/cloud/bigquery/storage/v1/protobuf.proto";
  23. import "google/cloud/bigquery/storage/v1/stream.proto";
  24. import "google/cloud/bigquery/storage/v1/table.proto";
  25. import "google/protobuf/timestamp.proto";
  26. import "google/protobuf/wrappers.proto";
  27. import "google/rpc/status.proto";
  28. option csharp_namespace = "Google.Cloud.BigQuery.Storage.V1";
  29. option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1;storage";
  30. option java_multiple_files = true;
  31. option java_outer_classname = "StorageProto";
  32. option java_package = "com.google.cloud.bigquery.storage.v1";
  33. option php_namespace = "Google\\Cloud\\BigQuery\\Storage\\V1";
  34. option (google.api.resource_definition) = {
  35. type: "bigquery.googleapis.com/Table"
  36. pattern: "projects/{project}/datasets/{dataset}/tables/{table}"
  37. };
  38. // BigQuery Read API.
  39. //
  40. // The Read API can be used to read data from BigQuery.
  41. service BigQueryRead {
  42. option (google.api.default_host) = "bigquerystorage.googleapis.com";
  43. option (google.api.oauth_scopes) =
  44. "https://www.googleapis.com/auth/bigquery,"
  45. "https://www.googleapis.com/auth/cloud-platform";
  46. // Creates a new read session. A read session divides the contents of a
  47. // BigQuery table into one or more streams, which can then be used to read
  48. // data from the table. The read session also specifies properties of the
  49. // data to be read, such as a list of columns or a push-down filter describing
  50. // the rows to be returned.
  51. //
  52. // A particular row can be read by at most one stream. When the caller has
  53. // reached the end of each stream in the session, then all the data in the
  54. // table has been read.
  55. //
  56. // Data is assigned to each stream such that roughly the same number of
  57. // rows can be read from each stream. Because the server-side unit for
  58. // assigning data is collections of rows, the API does not guarantee that
  59. // each stream will return the same number or rows. Additionally, the
  60. // limits are enforced based on the number of pre-filtered rows, so some
  61. // filters can lead to lopsided assignments.
  62. //
  63. // Read sessions automatically expire 6 hours after they are created and do
  64. // not require manual clean-up by the caller.
  65. rpc CreateReadSession(CreateReadSessionRequest) returns (ReadSession) {
  66. option (google.api.http) = {
  67. post: "/v1/{read_session.table=projects/*/datasets/*/tables/*}"
  68. body: "*"
  69. };
  70. option (google.api.method_signature) = "parent,read_session,max_stream_count";
  71. }
  72. // Reads rows from the stream in the format prescribed by the ReadSession.
  73. // Each response contains one or more table rows, up to a maximum of 100 MiB
  74. // per response; read requests which attempt to read individual rows larger
  75. // than 100 MiB will fail.
  76. //
  77. // Each request also returns a set of stream statistics reflecting the current
  78. // state of the stream.
  79. rpc ReadRows(ReadRowsRequest) returns (stream ReadRowsResponse) {
  80. option (google.api.http) = {
  81. get: "/v1/{read_stream=projects/*/locations/*/sessions/*/streams/*}"
  82. };
  83. option (google.api.method_signature) = "read_stream,offset";
  84. }
  85. // Splits a given `ReadStream` into two `ReadStream` objects. These
  86. // `ReadStream` objects are referred to as the primary and the residual
  87. // streams of the split. The original `ReadStream` can still be read from in
  88. // the same manner as before. Both of the returned `ReadStream` objects can
  89. // also be read from, and the rows returned by both child streams will be
  90. // the same as the rows read from the original stream.
  91. //
  92. // Moreover, the two child streams will be allocated back-to-back in the
  93. // original `ReadStream`. Concretely, it is guaranteed that for streams
  94. // original, primary, and residual, that original[0-j] = primary[0-j] and
  95. // original[j-n] = residual[0-m] once the streams have been read to
  96. // completion.
  97. rpc SplitReadStream(SplitReadStreamRequest) returns (SplitReadStreamResponse) {
  98. option (google.api.http) = {
  99. get: "/v1/{name=projects/*/locations/*/sessions/*/streams/*}"
  100. };
  101. }
  102. }
  103. // BigQuery Write API.
  104. //
  105. // The Write API can be used to write data to BigQuery.
  106. //
  107. // For supplementary information about the Write API, see:
  108. // https://cloud.google.com/bigquery/docs/write-api
  109. service BigQueryWrite {
  110. option (google.api.default_host) = "bigquerystorage.googleapis.com";
  111. option (google.api.oauth_scopes) =
  112. "https://www.googleapis.com/auth/bigquery,"
  113. "https://www.googleapis.com/auth/bigquery.insertdata,"
  114. "https://www.googleapis.com/auth/cloud-platform";
  115. // Creates a write stream to the given table.
  116. // Additionally, every table has a special stream named '_default'
  117. // to which data can be written. This stream doesn't need to be created using
  118. // CreateWriteStream. It is a stream that can be used simultaneously by any
  119. // number of clients. Data written to this stream is considered committed as
  120. // soon as an acknowledgement is received.
  121. rpc CreateWriteStream(CreateWriteStreamRequest) returns (WriteStream) {
  122. option (google.api.http) = {
  123. post: "/v1/{parent=projects/*/datasets/*/tables/*}"
  124. body: "write_stream"
  125. };
  126. option (google.api.method_signature) = "parent,write_stream";
  127. }
  128. // Appends data to the given stream.
  129. //
  130. // If `offset` is specified, the `offset` is checked against the end of
  131. // stream. The server returns `OUT_OF_RANGE` in `AppendRowsResponse` if an
  132. // attempt is made to append to an offset beyond the current end of the stream
  133. // or `ALREADY_EXISTS` if user provides an `offset` that has already been
  134. // written to. User can retry with adjusted offset within the same RPC
  135. // connection. If `offset` is not specified, append happens at the end of the
  136. // stream.
  137. //
  138. // The response contains an optional offset at which the append
  139. // happened. No offset information will be returned for appends to a
  140. // default stream.
  141. //
  142. // Responses are received in the same order in which requests are sent.
  143. // There will be one response for each successful inserted request. Responses
  144. // may optionally embed error information if the originating AppendRequest was
  145. // not successfully processed.
  146. //
  147. // The specifics of when successfully appended data is made visible to the
  148. // table are governed by the type of stream:
  149. //
  150. // * For COMMITTED streams (which includes the default stream), data is
  151. // visible immediately upon successful append.
  152. //
  153. // * For BUFFERED streams, data is made visible via a subsequent `FlushRows`
  154. // rpc which advances a cursor to a newer offset in the stream.
  155. //
  156. // * For PENDING streams, data is not made visible until the stream itself is
  157. // finalized (via the `FinalizeWriteStream` rpc), and the stream is explicitly
  158. // committed via the `BatchCommitWriteStreams` rpc.
  159. rpc AppendRows(stream AppendRowsRequest) returns (stream AppendRowsResponse) {
  160. option (google.api.http) = {
  161. post: "/v1/{write_stream=projects/*/datasets/*/tables/*/streams/*}"
  162. body: "*"
  163. };
  164. option (google.api.method_signature) = "write_stream";
  165. }
  166. // Gets information about a write stream.
  167. rpc GetWriteStream(GetWriteStreamRequest) returns (WriteStream) {
  168. option (google.api.http) = {
  169. post: "/v1/{name=projects/*/datasets/*/tables/*/streams/*}"
  170. body: "*"
  171. };
  172. option (google.api.method_signature) = "name";
  173. }
  174. // Finalize a write stream so that no new data can be appended to the
  175. // stream. Finalize is not supported on the '_default' stream.
  176. rpc FinalizeWriteStream(FinalizeWriteStreamRequest) returns (FinalizeWriteStreamResponse) {
  177. option (google.api.http) = {
  178. post: "/v1/{name=projects/*/datasets/*/tables/*/streams/*}"
  179. body: "*"
  180. };
  181. option (google.api.method_signature) = "name";
  182. }
  183. // Atomically commits a group of `PENDING` streams that belong to the same
  184. // `parent` table.
  185. //
  186. // Streams must be finalized before commit and cannot be committed multiple
  187. // times. Once a stream is committed, data in the stream becomes available
  188. // for read operations.
  189. rpc BatchCommitWriteStreams(BatchCommitWriteStreamsRequest) returns (BatchCommitWriteStreamsResponse) {
  190. option (google.api.http) = {
  191. get: "/v1/{parent=projects/*/datasets/*/tables/*}"
  192. };
  193. option (google.api.method_signature) = "parent";
  194. }
  195. // Flushes rows to a BUFFERED stream.
  196. //
  197. // If users are appending rows to BUFFERED stream, flush operation is
  198. // required in order for the rows to become available for reading. A
  199. // Flush operation flushes up to any previously flushed offset in a BUFFERED
  200. // stream, to the offset specified in the request.
  201. //
  202. // Flush is not supported on the _default stream, since it is not BUFFERED.
  203. rpc FlushRows(FlushRowsRequest) returns (FlushRowsResponse) {
  204. option (google.api.http) = {
  205. post: "/v1/{write_stream=projects/*/datasets/*/tables/*/streams/*}"
  206. body: "*"
  207. };
  208. option (google.api.method_signature) = "write_stream";
  209. }
  210. }
  211. // Request message for `CreateReadSession`.
  212. message CreateReadSessionRequest {
  213. // Required. The request project that owns the session, in the form of
  214. // `projects/{project_id}`.
  215. string parent = 1 [
  216. (google.api.field_behavior) = REQUIRED,
  217. (google.api.resource_reference) = {
  218. type: "cloudresourcemanager.googleapis.com/Project"
  219. }
  220. ];
  221. // Required. Session to be created.
  222. ReadSession read_session = 2 [(google.api.field_behavior) = REQUIRED];
  223. // Max initial number of streams. If unset or zero, the server will
  224. // provide a value of streams so as to produce reasonable throughput. Must be
  225. // non-negative. The number of streams may be lower than the requested number,
  226. // depending on the amount parallelism that is reasonable for the table.
  227. // There is a default system max limit of 1,000.
  228. //
  229. // This must be greater than or equal to preferred_min_stream_count.
  230. // Typically, clients should either leave this unset to let the system to
  231. // determine an upper bound OR set this a size for the maximum "units of work"
  232. // it can gracefully handle.
  233. int32 max_stream_count = 3;
  234. // The minimum preferred stream count. This parameter can be used to inform
  235. // the service that there is a desired lower bound on the number of streams.
  236. // This is typically a target parallelism of the client (e.g. a Spark
  237. // cluster with N-workers would set this to a low multiple of N to ensure
  238. // good cluster utilization).
  239. //
  240. // The system will make a best effort to provide at least this number of
  241. // streams, but in some cases might provide less.
  242. int32 preferred_min_stream_count = 4;
  243. }
  244. // Request message for `ReadRows`.
  245. message ReadRowsRequest {
  246. // Required. Stream to read rows from.
  247. string read_stream = 1 [
  248. (google.api.field_behavior) = REQUIRED,
  249. (google.api.resource_reference) = {
  250. type: "bigquerystorage.googleapis.com/ReadStream"
  251. }
  252. ];
  253. // The offset requested must be less than the last row read from Read.
  254. // Requesting a larger offset is undefined. If not specified, start reading
  255. // from offset zero.
  256. int64 offset = 2;
  257. }
  258. // Information on if the current connection is being throttled.
  259. message ThrottleState {
  260. // How much this connection is being throttled. Zero means no throttling,
  261. // 100 means fully throttled.
  262. int32 throttle_percent = 1;
  263. }
  264. // Estimated stream statistics for a given read Stream.
  265. message StreamStats {
  266. message Progress {
  267. // The fraction of rows assigned to the stream that have been processed by
  268. // the server so far, not including the rows in the current response
  269. // message.
  270. //
  271. // This value, along with `at_response_end`, can be used to interpolate
  272. // the progress made as the rows in the message are being processed using
  273. // the following formula: `at_response_start + (at_response_end -
  274. // at_response_start) * rows_processed_from_response / rows_in_response`.
  275. //
  276. // Note that if a filter is provided, the `at_response_end` value of the
  277. // previous response may not necessarily be equal to the
  278. // `at_response_start` value of the current response.
  279. double at_response_start = 1;
  280. // Similar to `at_response_start`, except that this value includes the
  281. // rows in the current response.
  282. double at_response_end = 2;
  283. }
  284. // Represents the progress of the current stream.
  285. Progress progress = 2;
  286. }
  287. // Response from calling `ReadRows` may include row data, progress and
  288. // throttling information.
  289. message ReadRowsResponse {
  290. // Row data is returned in format specified during session creation.
  291. oneof rows {
  292. // Serialized row data in AVRO format.
  293. AvroRows avro_rows = 3;
  294. // Serialized row data in Arrow RecordBatch format.
  295. ArrowRecordBatch arrow_record_batch = 4;
  296. }
  297. // Number of serialized rows in the rows block.
  298. int64 row_count = 6;
  299. // Statistics for the stream.
  300. StreamStats stats = 2;
  301. // Throttling state. If unset, the latest response still describes
  302. // the current throttling status.
  303. ThrottleState throttle_state = 5;
  304. // The schema for the read. If read_options.selected_fields is set, the
  305. // schema may be different from the table schema as it will only contain
  306. // the selected fields. This schema is equivalent to the one returned by
  307. // CreateSession. This field is only populated in the first ReadRowsResponse
  308. // RPC.
  309. oneof schema {
  310. // Output only. Avro schema.
  311. AvroSchema avro_schema = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  312. // Output only. Arrow schema.
  313. ArrowSchema arrow_schema = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
  314. }
  315. }
  316. // Request message for `SplitReadStream`.
  317. message SplitReadStreamRequest {
  318. // Required. Name of the stream to split.
  319. string name = 1 [
  320. (google.api.field_behavior) = REQUIRED,
  321. (google.api.resource_reference) = {
  322. type: "bigquerystorage.googleapis.com/ReadStream"
  323. }
  324. ];
  325. // A value in the range (0.0, 1.0) that specifies the fractional point at
  326. // which the original stream should be split. The actual split point is
  327. // evaluated on pre-filtered rows, so if a filter is provided, then there is
  328. // no guarantee that the division of the rows between the new child streams
  329. // will be proportional to this fractional value. Additionally, because the
  330. // server-side unit for assigning data is collections of rows, this fraction
  331. // will always map to a data storage boundary on the server side.
  332. double fraction = 2;
  333. }
  334. // Response message for `SplitReadStream`.
  335. message SplitReadStreamResponse {
  336. // Primary stream, which contains the beginning portion of
  337. // |original_stream|. An empty value indicates that the original stream can no
  338. // longer be split.
  339. ReadStream primary_stream = 1;
  340. // Remainder stream, which contains the tail of |original_stream|. An empty
  341. // value indicates that the original stream can no longer be split.
  342. ReadStream remainder_stream = 2;
  343. }
  344. // Request message for `CreateWriteStream`.
  345. message CreateWriteStreamRequest {
  346. // Required. Reference to the table to which the stream belongs, in the format
  347. // of `projects/{project}/datasets/{dataset}/tables/{table}`.
  348. string parent = 1 [
  349. (google.api.field_behavior) = REQUIRED,
  350. (google.api.resource_reference) = {
  351. type: "bigquery.googleapis.com/Table"
  352. }
  353. ];
  354. // Required. Stream to be created.
  355. WriteStream write_stream = 2 [(google.api.field_behavior) = REQUIRED];
  356. }
  357. // Request message for `AppendRows`.
  358. //
  359. // Due to the nature of AppendRows being a bidirectional streaming RPC, certain
  360. // parts of the AppendRowsRequest need only be specified for the first request
  361. // sent each time the gRPC network connection is opened/reopened.
  362. //
  363. // The size of a single AppendRowsRequest must be less than 10 MB in size.
  364. // Requests larger than this return an error, typically `INVALID_ARGUMENT`.
  365. message AppendRowsRequest {
  366. // ProtoData contains the data rows and schema when constructing append
  367. // requests.
  368. message ProtoData {
  369. // Proto schema used to serialize the data. This value only needs to be
  370. // provided as part of the first request on a gRPC network connection,
  371. // and will be ignored for subsequent requests on the connection.
  372. ProtoSchema writer_schema = 1;
  373. // Serialized row data in protobuf message format.
  374. // Currently, the backend expects the serialized rows to adhere to
  375. // proto2 semantics when appending rows, particularly with respect to
  376. // how default values are encoded.
  377. ProtoRows rows = 2;
  378. }
  379. // An enum to indicate how to interpret missing values. Missing values are
  380. // fields present in user schema but missing in rows. A missing value can
  381. // represent a NULL or a column default value defined in BigQuery table
  382. // schema.
  383. enum MissingValueInterpretation {
  384. // Invalid missing value interpretation. Requests with this value will be
  385. // rejected.
  386. MISSING_VALUE_INTERPRETATION_UNSPECIFIED = 0;
  387. // Missing value is interpreted as NULL.
  388. NULL_VALUE = 1;
  389. // Missing value is interpreted as column default value if declared in the
  390. // table schema, NULL otherwise.
  391. DEFAULT_VALUE = 2;
  392. }
  393. // Required. The write_stream identifies the target of the append operation, and only
  394. // needs to be specified as part of the first request on the gRPC connection.
  395. // If provided for subsequent requests, it must match the value of the first
  396. // request.
  397. //
  398. // For explicitly created write streams, the format is:
  399. //
  400. // * `projects/{project}/datasets/{dataset}/tables/{table}/streams/{id}`
  401. //
  402. // For the special default stream, the format is:
  403. //
  404. // * `projects/{project}/datasets/{dataset}/tables/{table}/streams/_default`.
  405. string write_stream = 1 [
  406. (google.api.field_behavior) = REQUIRED,
  407. (google.api.resource_reference) = {
  408. type: "bigquerystorage.googleapis.com/WriteStream"
  409. }
  410. ];
  411. // If present, the write is only performed if the next append offset is same
  412. // as the provided value. If not present, the write is performed at the
  413. // current end of stream. Specifying a value for this field is not allowed
  414. // when calling AppendRows for the '_default' stream.
  415. google.protobuf.Int64Value offset = 2;
  416. // Input rows. The `writer_schema` field must be specified at the initial
  417. // request and currently, it will be ignored if specified in following
  418. // requests. Following requests must have data in the same format as the
  419. // initial request.
  420. oneof rows {
  421. // Rows in proto format.
  422. ProtoData proto_rows = 4;
  423. }
  424. // Id set by client to annotate its identity. Only initial request setting is
  425. // respected.
  426. string trace_id = 6;
  427. // A map to indicate how to interpret missing value for some fields. Missing
  428. // values are fields present in user schema but missing in rows. The key is
  429. // the field name. The value is the interpretation of missing values for the
  430. // field.
  431. //
  432. // For example, a map {'foo': NULL_VALUE, 'bar': DEFAULT_VALUE} means all
  433. // missing values in field foo are interpreted as NULL, all missing values in
  434. // field bar are interpreted as the default value of field bar in table
  435. // schema.
  436. //
  437. // If a field is not in this map and has missing values, the missing values
  438. // in this field are interpreted as NULL.
  439. //
  440. // This field only applies to the current request, it won't affect other
  441. // requests on the connection.
  442. //
  443. // Currently, field name can only be top-level column name, can't be a struct
  444. // field path like 'foo.bar'.
  445. map<string, MissingValueInterpretation> missing_value_interpretations = 7;
  446. }
  447. // Response message for `AppendRows`.
  448. message AppendRowsResponse {
  449. // AppendResult is returned for successful append requests.
  450. message AppendResult {
  451. // The row offset at which the last append occurred. The offset will not be
  452. // set if appending using default streams.
  453. google.protobuf.Int64Value offset = 1;
  454. }
  455. oneof response {
  456. // Result if the append is successful.
  457. AppendResult append_result = 1;
  458. // Error returned when problems were encountered. If present,
  459. // it indicates rows were not accepted into the system.
  460. // Users can retry or continue with other append requests within the
  461. // same connection.
  462. //
  463. // Additional information about error signalling:
  464. //
  465. // ALREADY_EXISTS: Happens when an append specified an offset, and the
  466. // backend already has received data at this offset. Typically encountered
  467. // in retry scenarios, and can be ignored.
  468. //
  469. // OUT_OF_RANGE: Returned when the specified offset in the stream is beyond
  470. // the current end of the stream.
  471. //
  472. // INVALID_ARGUMENT: Indicates a malformed request or data.
  473. //
  474. // ABORTED: Request processing is aborted because of prior failures. The
  475. // request can be retried if previous failure is addressed.
  476. //
  477. // INTERNAL: Indicates server side error(s) that can be retried.
  478. google.rpc.Status error = 2;
  479. }
  480. // If backend detects a schema update, pass it to user so that user can
  481. // use it to input new type of message. It will be empty when no schema
  482. // updates have occurred.
  483. TableSchema updated_schema = 3;
  484. // If a request failed due to corrupted rows, no rows in the batch will be
  485. // appended. The API will return row level error info, so that the caller can
  486. // remove the bad rows and retry the request.
  487. repeated RowError row_errors = 4;
  488. // The target of the append operation. Matches the write_stream in the
  489. // corresponding request.
  490. string write_stream = 5;
  491. }
  492. // Request message for `GetWriteStreamRequest`.
  493. message GetWriteStreamRequest {
  494. // Required. Name of the stream to get, in the form of
  495. // `projects/{project}/datasets/{dataset}/tables/{table}/streams/{stream}`.
  496. string name = 1 [
  497. (google.api.field_behavior) = REQUIRED,
  498. (google.api.resource_reference) = {
  499. type: "bigquerystorage.googleapis.com/WriteStream"
  500. }
  501. ];
  502. // Indicates whether to get full or partial view of the WriteStream. If
  503. // not set, view returned will be basic.
  504. WriteStreamView view = 3;
  505. }
  506. // Request message for `BatchCommitWriteStreams`.
  507. message BatchCommitWriteStreamsRequest {
  508. // Required. Parent table that all the streams should belong to, in the form of
  509. // `projects/{project}/datasets/{dataset}/tables/{table}`.
  510. string parent = 1 [
  511. (google.api.field_behavior) = REQUIRED,
  512. (google.api.resource_reference) = {
  513. type: "bigquery.googleapis.com/Table"
  514. }
  515. ];
  516. // Required. The group of streams that will be committed atomically.
  517. repeated string write_streams = 2 [(google.api.field_behavior) = REQUIRED];
  518. }
  519. // Response message for `BatchCommitWriteStreams`.
  520. message BatchCommitWriteStreamsResponse {
  521. // The time at which streams were committed in microseconds granularity.
  522. // This field will only exist when there are no stream errors.
  523. // **Note** if this field is not set, it means the commit was not successful.
  524. google.protobuf.Timestamp commit_time = 1;
  525. // Stream level error if commit failed. Only streams with error will be in
  526. // the list.
  527. // If empty, there is no error and all streams are committed successfully.
  528. // If non empty, certain streams have errors and ZERO stream is committed due
  529. // to atomicity guarantee.
  530. repeated StorageError stream_errors = 2;
  531. }
  532. // Request message for invoking `FinalizeWriteStream`.
  533. message FinalizeWriteStreamRequest {
  534. // Required. Name of the stream to finalize, in the form of
  535. // `projects/{project}/datasets/{dataset}/tables/{table}/streams/{stream}`.
  536. string name = 1 [
  537. (google.api.field_behavior) = REQUIRED,
  538. (google.api.resource_reference) = {
  539. type: "bigquerystorage.googleapis.com/WriteStream"
  540. }
  541. ];
  542. }
  543. // Response message for `FinalizeWriteStream`.
  544. message FinalizeWriteStreamResponse {
  545. // Number of rows in the finalized stream.
  546. int64 row_count = 1;
  547. }
  548. // Request message for `FlushRows`.
  549. message FlushRowsRequest {
  550. // Required. The stream that is the target of the flush operation.
  551. string write_stream = 1 [
  552. (google.api.field_behavior) = REQUIRED,
  553. (google.api.resource_reference) = {
  554. type: "bigquerystorage.googleapis.com/WriteStream"
  555. }
  556. ];
  557. // Ending offset of the flush operation. Rows before this offset(including
  558. // this offset) will be flushed.
  559. google.protobuf.Int64Value offset = 2;
  560. }
  561. // Respond message for `FlushRows`.
  562. message FlushRowsResponse {
  563. // The rows before this offset (including this offset) are flushed.
  564. int64 offset = 1;
  565. }
  566. // Structured custom BigQuery Storage error message. The error can be attached
  567. // as error details in the returned rpc Status. In particular, the use of error
  568. // codes allows more structured error handling, and reduces the need to evaluate
  569. // unstructured error text strings.
  570. message StorageError {
  571. // Error code for `StorageError`.
  572. enum StorageErrorCode {
  573. // Default error.
  574. STORAGE_ERROR_CODE_UNSPECIFIED = 0;
  575. // Table is not found in the system.
  576. TABLE_NOT_FOUND = 1;
  577. // Stream is already committed.
  578. STREAM_ALREADY_COMMITTED = 2;
  579. // Stream is not found.
  580. STREAM_NOT_FOUND = 3;
  581. // Invalid Stream type.
  582. // For example, you try to commit a stream that is not pending.
  583. INVALID_STREAM_TYPE = 4;
  584. // Invalid Stream state.
  585. // For example, you try to commit a stream that is not finalized or is
  586. // garbaged.
  587. INVALID_STREAM_STATE = 5;
  588. // Stream is finalized.
  589. STREAM_FINALIZED = 6;
  590. // There is a schema mismatch and it is caused by user schema has extra
  591. // field than bigquery schema.
  592. SCHEMA_MISMATCH_EXTRA_FIELDS = 7;
  593. // Offset already exists.
  594. OFFSET_ALREADY_EXISTS = 8;
  595. // Offset out of range.
  596. OFFSET_OUT_OF_RANGE = 9;
  597. }
  598. // BigQuery Storage specific error code.
  599. StorageErrorCode code = 1;
  600. // Name of the failed entity.
  601. string entity = 2;
  602. // Message that describes the error.
  603. string error_message = 3;
  604. }
  605. // The message that presents row level error info in a request.
  606. message RowError {
  607. // Error code for `RowError`.
  608. enum RowErrorCode {
  609. // Default error.
  610. ROW_ERROR_CODE_UNSPECIFIED = 0;
  611. // One or more fields in the row has errors.
  612. FIELDS_ERROR = 1;
  613. }
  614. // Index of the malformed row in the request.
  615. int64 index = 1;
  616. // Structured error reason for a row error.
  617. RowErrorCode code = 2;
  618. // Description of the issue encountered when processing the row.
  619. string message = 3;
  620. }