table.proto 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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/field_behavior.proto";
  17. option csharp_namespace = "Google.Cloud.BigQuery.Storage.V1";
  18. option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1;storage";
  19. option java_multiple_files = true;
  20. option java_outer_classname = "TableProto";
  21. option java_package = "com.google.cloud.bigquery.storage.v1";
  22. option php_namespace = "Google\\Cloud\\BigQuery\\Storage\\V1";
  23. // Schema of a table. This schema is a subset of
  24. // google.cloud.bigquery.v2.TableSchema containing information necessary to
  25. // generate valid message to write to BigQuery.
  26. message TableSchema {
  27. // Describes the fields in a table.
  28. repeated TableFieldSchema fields = 1;
  29. }
  30. // TableFieldSchema defines a single field/column within a table schema.
  31. message TableFieldSchema {
  32. enum Type {
  33. // Illegal value
  34. TYPE_UNSPECIFIED = 0;
  35. // 64K, UTF8
  36. STRING = 1;
  37. // 64-bit signed
  38. INT64 = 2;
  39. // 64-bit IEEE floating point
  40. DOUBLE = 3;
  41. // Aggregate type
  42. STRUCT = 4;
  43. // 64K, Binary
  44. BYTES = 5;
  45. // 2-valued
  46. BOOL = 6;
  47. // 64-bit signed usec since UTC epoch
  48. TIMESTAMP = 7;
  49. // Civil date - Year, Month, Day
  50. DATE = 8;
  51. // Civil time - Hour, Minute, Second, Microseconds
  52. TIME = 9;
  53. // Combination of civil date and civil time
  54. DATETIME = 10;
  55. // Geography object
  56. GEOGRAPHY = 11;
  57. // Numeric value
  58. NUMERIC = 12;
  59. // BigNumeric value
  60. BIGNUMERIC = 13;
  61. // Interval
  62. INTERVAL = 14;
  63. // JSON, String
  64. JSON = 15;
  65. }
  66. enum Mode {
  67. // Illegal value
  68. MODE_UNSPECIFIED = 0;
  69. NULLABLE = 1;
  70. REQUIRED = 2;
  71. REPEATED = 3;
  72. }
  73. // Required. The field name. The name must contain only letters (a-z, A-Z),
  74. // numbers (0-9), or underscores (_), and must start with a letter or
  75. // underscore. The maximum length is 128 characters.
  76. string name = 1 [(google.api.field_behavior) = REQUIRED];
  77. // Required. The field data type.
  78. Type type = 2 [(google.api.field_behavior) = REQUIRED];
  79. // Optional. The field mode. The default value is NULLABLE.
  80. Mode mode = 3 [(google.api.field_behavior) = OPTIONAL];
  81. // Optional. Describes the nested schema fields if the type property is set to STRUCT.
  82. repeated TableFieldSchema fields = 4 [(google.api.field_behavior) = OPTIONAL];
  83. // Optional. The field description. The maximum length is 1,024 characters.
  84. string description = 6 [(google.api.field_behavior) = OPTIONAL];
  85. // Optional. Maximum length of values of this field for STRINGS or BYTES.
  86. //
  87. // If max_length is not specified, no maximum length constraint is imposed
  88. // on this field.
  89. //
  90. // If type = "STRING", then max_length represents the maximum UTF-8
  91. // length of strings in this field.
  92. //
  93. // If type = "BYTES", then max_length represents the maximum number of
  94. // bytes in this field.
  95. //
  96. // It is invalid to set this field if type is not "STRING" or "BYTES".
  97. int64 max_length = 7 [(google.api.field_behavior) = OPTIONAL];
  98. // Optional. Precision (maximum number of total digits in base 10) and scale
  99. // (maximum number of digits in the fractional part in base 10) constraints
  100. // for values of this field for NUMERIC or BIGNUMERIC.
  101. //
  102. // It is invalid to set precision or scale if type is not "NUMERIC" or
  103. // "BIGNUMERIC".
  104. //
  105. // If precision and scale are not specified, no value range constraint is
  106. // imposed on this field insofar as values are permitted by the type.
  107. //
  108. // Values of this NUMERIC or BIGNUMERIC field must be in this range when:
  109. //
  110. // * Precision (P) and scale (S) are specified:
  111. // [-10^(P-S) + 10^(-S), 10^(P-S) - 10^(-S)]
  112. // * Precision (P) is specified but not scale (and thus scale is
  113. // interpreted to be equal to zero):
  114. // [-10^P + 1, 10^P - 1].
  115. //
  116. // Acceptable values for precision and scale if both are specified:
  117. //
  118. // * If type = "NUMERIC":
  119. // 1 <= precision - scale <= 29 and 0 <= scale <= 9.
  120. // * If type = "BIGNUMERIC":
  121. // 1 <= precision - scale <= 38 and 0 <= scale <= 38.
  122. //
  123. // Acceptable values for precision if only precision is specified but not
  124. // scale (and thus scale is interpreted to be equal to zero):
  125. //
  126. // * If type = "NUMERIC": 1 <= precision <= 29.
  127. // * If type = "BIGNUMERIC": 1 <= precision <= 38.
  128. //
  129. // If scale is specified but not precision, then it is invalid.
  130. int64 precision = 8 [(google.api.field_behavior) = OPTIONAL];
  131. // Optional. See documentation for precision.
  132. int64 scale = 9 [(google.api.field_behavior) = OPTIONAL];
  133. }