stream.proto 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. // Copyright 2021 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/field_behavior.proto";
  17. import "google/api/resource.proto";
  18. import "google/cloud/bigquery/storage/v1/arrow.proto";
  19. import "google/cloud/bigquery/storage/v1/avro.proto";
  20. import "google/protobuf/timestamp.proto";
  21. option csharp_namespace = "Google.Cloud.BigQuery.Storage.V1";
  22. option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1;storage";
  23. option java_multiple_files = true;
  24. option java_outer_classname = "StreamProto";
  25. option java_package = "com.google.cloud.bigquery.storage.v1";
  26. option php_namespace = "Google\\Cloud\\BigQuery\\Storage\\V1";
  27. // Data format for input or output data.
  28. enum DataFormat {
  29. DATA_FORMAT_UNSPECIFIED = 0;
  30. // Avro is a standard open source row based file format.
  31. // See https://avro.apache.org/ for more details.
  32. AVRO = 1;
  33. // Arrow is a standard open source column-based message format.
  34. // See https://arrow.apache.org/ for more details.
  35. ARROW = 2;
  36. }
  37. // Information about the ReadSession.
  38. message ReadSession {
  39. option (google.api.resource) = {
  40. type: "bigquerystorage.googleapis.com/ReadSession"
  41. pattern: "projects/{project}/locations/{location}/sessions/{session}"
  42. };
  43. // Additional attributes when reading a table.
  44. message TableModifiers {
  45. // The snapshot time of the table. If not set, interpreted as now.
  46. google.protobuf.Timestamp snapshot_time = 1;
  47. }
  48. // Options dictating how we read a table.
  49. message TableReadOptions {
  50. // Names of the fields in the table that should be read. If empty, all
  51. // fields will be read. If the specified field is a nested field, all
  52. // the sub-fields in the field will be selected. The output field order is
  53. // unrelated to the order of fields in selected_fields.
  54. repeated string selected_fields = 1;
  55. // SQL text filtering statement, similar to a WHERE clause in a query.
  56. // Aggregates are not supported.
  57. //
  58. // Examples: "int_field > 5"
  59. // "date_field = CAST('2014-9-27' as DATE)"
  60. // "nullable_field is not NULL"
  61. // "st_equals(geo_field, st_geofromtext("POINT(2, 2)"))"
  62. // "numeric_field BETWEEN 1.0 AND 5.0"
  63. //
  64. // Restricted to a maximum length for 1 MB.
  65. string row_restriction = 2;
  66. oneof output_format_serialization_options {
  67. // Optional. Options specific to the Apache Arrow output format.
  68. ArrowSerializationOptions arrow_serialization_options = 3 [(google.api.field_behavior) = OPTIONAL];
  69. }
  70. }
  71. // Output only. Unique identifier for the session, in the form
  72. // `projects/{project_id}/locations/{location}/sessions/{session_id}`.
  73. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  74. // Output only. Time at which the session becomes invalid. After this time, subsequent
  75. // requests to read this Session will return errors. The expire_time is
  76. // automatically assigned and currently cannot be specified or updated.
  77. google.protobuf.Timestamp expire_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  78. // Immutable. Data format of the output data.
  79. DataFormat data_format = 3 [(google.api.field_behavior) = IMMUTABLE];
  80. // The schema for the read. If read_options.selected_fields is set, the
  81. // schema may be different from the table schema as it will only contain
  82. // the selected fields.
  83. oneof schema {
  84. // Output only. Avro schema.
  85. AvroSchema avro_schema = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  86. // Output only. Arrow schema.
  87. ArrowSchema arrow_schema = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
  88. }
  89. // Immutable. Table that this ReadSession is reading from, in the form
  90. // `projects/{project_id}/datasets/{dataset_id}/tables/{table_id}`
  91. string table = 6 [
  92. (google.api.field_behavior) = IMMUTABLE,
  93. (google.api.resource_reference) = {
  94. type: "bigquery.googleapis.com/Table"
  95. }
  96. ];
  97. // Optional. Any modifiers which are applied when reading from the specified table.
  98. TableModifiers table_modifiers = 7 [(google.api.field_behavior) = OPTIONAL];
  99. // Optional. Read options for this session (e.g. column selection, filters).
  100. TableReadOptions read_options = 8 [(google.api.field_behavior) = OPTIONAL];
  101. // Output only. A list of streams created with the session.
  102. //
  103. // At least one stream is created with the session. In the future, larger
  104. // request_stream_count values *may* result in this list being unpopulated,
  105. // in that case, the user will need to use a List method to get the streams
  106. // instead, which is not yet available.
  107. repeated ReadStream streams = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
  108. }
  109. // Information about a single stream that gets data out of the storage system.
  110. // Most of the information about `ReadStream` instances is aggregated, making
  111. // `ReadStream` lightweight.
  112. message ReadStream {
  113. option (google.api.resource) = {
  114. type: "bigquerystorage.googleapis.com/ReadStream"
  115. pattern: "projects/{project}/locations/{location}/sessions/{session}/streams/{stream}"
  116. };
  117. // Output only. Name of the stream, in the form
  118. // `projects/{project_id}/locations/{location}/sessions/{session_id}/streams/{stream_id}`.
  119. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  120. }