Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/google/cloud/bigquery_storage_v1/types/table.py: 100%
39 statements
« prev ^ index » next coverage.py v7.2.2, created at 2023-03-26 06:10 +0000
« prev ^ index » next coverage.py v7.2.2, created at 2023-03-26 06:10 +0000
1# -*- coding: utf-8 -*-
2# Copyright 2022 Google LLC
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16from __future__ import annotations
18from typing import MutableMapping, MutableSequence
20import proto # type: ignore
23__protobuf__ = proto.module(
24 package="google.cloud.bigquery.storage.v1",
25 manifest={
26 "TableSchema",
27 "TableFieldSchema",
28 },
29)
32class TableSchema(proto.Message):
33 r"""Schema of a table. This schema is a subset of
34 google.cloud.bigquery.v2.TableSchema containing information
35 necessary to generate valid message to write to BigQuery.
37 Attributes:
38 fields (MutableSequence[google.cloud.bigquery_storage_v1.types.TableFieldSchema]):
39 Describes the fields in a table.
40 """
42 fields: MutableSequence["TableFieldSchema"] = proto.RepeatedField(
43 proto.MESSAGE,
44 number=1,
45 message="TableFieldSchema",
46 )
49class TableFieldSchema(proto.Message):
50 r"""TableFieldSchema defines a single field/column within a table
51 schema.
53 Attributes:
54 name (str):
55 Required. The field name. The name must contain only letters
56 (a-z, A-Z), numbers (0-9), or underscores (_), and must
57 start with a letter or underscore. The maximum length is 128
58 characters.
59 type_ (google.cloud.bigquery_storage_v1.types.TableFieldSchema.Type):
60 Required. The field data type.
61 mode (google.cloud.bigquery_storage_v1.types.TableFieldSchema.Mode):
62 Optional. The field mode. The default value
63 is NULLABLE.
64 fields (MutableSequence[google.cloud.bigquery_storage_v1.types.TableFieldSchema]):
65 Optional. Describes the nested schema fields
66 if the type property is set to STRUCT.
67 description (str):
68 Optional. The field description. The maximum
69 length is 1,024 characters.
70 max_length (int):
71 Optional. Maximum length of values of this field for STRINGS
72 or BYTES.
74 If max_length is not specified, no maximum length constraint
75 is imposed on this field.
77 If type = "STRING", then max_length represents the maximum
78 UTF-8 length of strings in this field.
80 If type = "BYTES", then max_length represents the maximum
81 number of bytes in this field.
83 It is invalid to set this field if type is not "STRING" or
84 "BYTES".
85 precision (int):
86 Optional. Precision (maximum number of total digits in base
87 10) and scale (maximum number of digits in the fractional
88 part in base 10) constraints for values of this field for
89 NUMERIC or BIGNUMERIC.
91 It is invalid to set precision or scale if type is not
92 "NUMERIC" or "BIGNUMERIC".
94 If precision and scale are not specified, no value range
95 constraint is imposed on this field insofar as values are
96 permitted by the type.
98 Values of this NUMERIC or BIGNUMERIC field must be in this
99 range when:
101 - Precision (P) and scale (S) are specified: [-10^(P-S) +
102 10^(-S), 10^(P-S) - 10^(-S)]
103 - Precision (P) is specified but not scale (and thus scale
104 is interpreted to be equal to zero): [-10^P + 1, 10^P -
105 1].
107 Acceptable values for precision and scale if both are
108 specified:
110 - If type = "NUMERIC": 1 <= precision - scale <= 29 and 0
111 <= scale <= 9.
112 - If type = "BIGNUMERIC": 1 <= precision - scale <= 38 and
113 0 <= scale <= 38.
115 Acceptable values for precision if only precision is
116 specified but not scale (and thus scale is interpreted to be
117 equal to zero):
119 - If type = "NUMERIC": 1 <= precision <= 29.
120 - If type = "BIGNUMERIC": 1 <= precision <= 38.
122 If scale is specified but not precision, then it is invalid.
123 scale (int):
124 Optional. See documentation for precision.
125 default_value_expression (str):
126 Optional. A SQL expression to specify the [default value]
127 (https://cloud.google.com/bigquery/docs/default-values) for
128 this field.
129 """
131 class Type(proto.Enum):
132 r"""
134 Values:
135 TYPE_UNSPECIFIED (0):
136 Illegal value
137 STRING (1):
138 64K, UTF8
139 INT64 (2):
140 64-bit signed
141 DOUBLE (3):
142 64-bit IEEE floating point
143 STRUCT (4):
144 Aggregate type
145 BYTES (5):
146 64K, Binary
147 BOOL (6):
148 2-valued
149 TIMESTAMP (7):
150 64-bit signed usec since UTC epoch
151 DATE (8):
152 Civil date - Year, Month, Day
153 TIME (9):
154 Civil time - Hour, Minute, Second,
155 Microseconds
156 DATETIME (10):
157 Combination of civil date and civil time
158 GEOGRAPHY (11):
159 Geography object
160 NUMERIC (12):
161 Numeric value
162 BIGNUMERIC (13):
163 BigNumeric value
164 INTERVAL (14):
165 Interval
166 JSON (15):
167 JSON, String
168 """
169 TYPE_UNSPECIFIED = 0
170 STRING = 1
171 INT64 = 2
172 DOUBLE = 3
173 STRUCT = 4
174 BYTES = 5
175 BOOL = 6
176 TIMESTAMP = 7
177 DATE = 8
178 TIME = 9
179 DATETIME = 10
180 GEOGRAPHY = 11
181 NUMERIC = 12
182 BIGNUMERIC = 13
183 INTERVAL = 14
184 JSON = 15
186 class Mode(proto.Enum):
187 r"""
189 Values:
190 MODE_UNSPECIFIED (0):
191 Illegal value
192 NULLABLE (1):
193 No description available.
194 REQUIRED (2):
195 No description available.
196 REPEATED (3):
197 No description available.
198 """
199 MODE_UNSPECIFIED = 0
200 NULLABLE = 1
201 REQUIRED = 2
202 REPEATED = 3
204 name: str = proto.Field(
205 proto.STRING,
206 number=1,
207 )
208 type_: Type = proto.Field(
209 proto.ENUM,
210 number=2,
211 enum=Type,
212 )
213 mode: Mode = proto.Field(
214 proto.ENUM,
215 number=3,
216 enum=Mode,
217 )
218 fields: MutableSequence["TableFieldSchema"] = proto.RepeatedField(
219 proto.MESSAGE,
220 number=4,
221 message="TableFieldSchema",
222 )
223 description: str = proto.Field(
224 proto.STRING,
225 number=6,
226 )
227 max_length: int = proto.Field(
228 proto.INT64,
229 number=7,
230 )
231 precision: int = proto.Field(
232 proto.INT64,
233 number=8,
234 )
235 scale: int = proto.Field(
236 proto.INT64,
237 number=9,
238 )
239 default_value_expression: str = proto.Field(
240 proto.STRING,
241 number=10,
242 )
245__all__ = tuple(sorted(__protobuf__.manifest))