Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Commit 69e3fb8

Browse files
feat: add BigQuery Storage Write API v1 (#301)
* feat: add BigQuery Storage Write API v1 Committer: @yirutang PiperOrigin-RevId: 397350004 Source-Link: googleapis/googleapis@b4da4fd Source-Link: googleapis/googleapis-gen@67bcfcf Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjdiY2ZjZmEwMGE0MTEzZTk2OGJhYzFhMTBkMGFkMGMxYjdkYzQ1YiJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent eb74af9 commit 69e3fb8

File tree

24 files changed

+5842
-30
lines changed

24 files changed

+5842
-30
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
BigQueryWrite
2+
-------------------------------
3+
4+
.. automodule:: google.cloud.bigquery_storage_v1.services.big_query_write
5+
:members:
6+
:inherited-members:

docs/bigquery_storage_v1/services.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ Services for Google Cloud Bigquery Storage v1 API
44
:maxdepth: 2
55

66
big_query_read
7+
big_query_write

google/cloud/bigquery_storage/__init__.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
#
1616

1717
from google.cloud.bigquery_storage_v1 import BigQueryReadClient
18+
from google.cloud.bigquery_storage_v1.services.big_query_write.client import (
19+
BigQueryWriteClient,
20+
)
21+
from google.cloud.bigquery_storage_v1.services.big_query_write.async_client import (
22+
BigQueryWriteAsyncClient,
23+
)
1824

1925
from google.cloud.bigquery_storage_v1 import gapic_types as types
2026
from google.cloud.bigquery_storage_v1 import __version__
@@ -23,34 +29,72 @@
2329
from google.cloud.bigquery_storage_v1.types.arrow import ArrowSerializationOptions
2430
from google.cloud.bigquery_storage_v1.types.avro import AvroRows
2531
from google.cloud.bigquery_storage_v1.types.avro import AvroSchema
32+
from google.cloud.bigquery_storage_v1.types.protobuf import ProtoRows
33+
from google.cloud.bigquery_storage_v1.types.protobuf import ProtoSchema
34+
from google.cloud.bigquery_storage_v1.types.storage import AppendRowsRequest
35+
from google.cloud.bigquery_storage_v1.types.storage import AppendRowsResponse
36+
from google.cloud.bigquery_storage_v1.types.storage import (
37+
BatchCommitWriteStreamsRequest,
38+
)
39+
from google.cloud.bigquery_storage_v1.types.storage import (
40+
BatchCommitWriteStreamsResponse,
41+
)
2642
from google.cloud.bigquery_storage_v1.types.storage import CreateReadSessionRequest
43+
from google.cloud.bigquery_storage_v1.types.storage import CreateWriteStreamRequest
44+
from google.cloud.bigquery_storage_v1.types.storage import FinalizeWriteStreamRequest
45+
from google.cloud.bigquery_storage_v1.types.storage import FinalizeWriteStreamResponse
46+
from google.cloud.bigquery_storage_v1.types.storage import FlushRowsRequest
47+
from google.cloud.bigquery_storage_v1.types.storage import FlushRowsResponse
48+
from google.cloud.bigquery_storage_v1.types.storage import GetWriteStreamRequest
2749
from google.cloud.bigquery_storage_v1.types.storage import ReadRowsRequest
2850
from google.cloud.bigquery_storage_v1.types.storage import ReadRowsResponse
2951
from google.cloud.bigquery_storage_v1.types.storage import SplitReadStreamRequest
3052
from google.cloud.bigquery_storage_v1.types.storage import SplitReadStreamResponse
53+
from google.cloud.bigquery_storage_v1.types.storage import StorageError
3154
from google.cloud.bigquery_storage_v1.types.storage import StreamStats
3255
from google.cloud.bigquery_storage_v1.types.storage import ThrottleState
3356
from google.cloud.bigquery_storage_v1.types.stream import ReadSession
3457
from google.cloud.bigquery_storage_v1.types.stream import ReadStream
58+
from google.cloud.bigquery_storage_v1.types.stream import WriteStream
3559
from google.cloud.bigquery_storage_v1.types.stream import DataFormat
60+
from google.cloud.bigquery_storage_v1.types.table import TableFieldSchema
61+
from google.cloud.bigquery_storage_v1.types.table import TableSchema
3662

3763
__all__ = (
3864
"BigQueryReadClient",
65+
"BigQueryWriteClient",
66+
"BigQueryWriteAsyncClient",
3967
"__version__",
4068
"types",
4169
"ArrowRecordBatch",
4270
"ArrowSchema",
4371
"ArrowSerializationOptions",
4472
"AvroRows",
4573
"AvroSchema",
74+
"ProtoRows",
75+
"ProtoSchema",
76+
"AppendRowsRequest",
77+
"AppendRowsResponse",
78+
"BatchCommitWriteStreamsRequest",
79+
"BatchCommitWriteStreamsResponse",
4680
"CreateReadSessionRequest",
81+
"CreateWriteStreamRequest",
82+
"FinalizeWriteStreamRequest",
83+
"FinalizeWriteStreamResponse",
84+
"FlushRowsRequest",
85+
"FlushRowsResponse",
86+
"GetWriteStreamRequest",
4787
"ReadRowsRequest",
4888
"ReadRowsResponse",
4989
"SplitReadStreamRequest",
5090
"SplitReadStreamResponse",
91+
"StorageError",
5192
"StreamStats",
5293
"ThrottleState",
5394
"ReadSession",
5495
"ReadStream",
96+
"WriteStream",
5597
"DataFormat",
98+
"TableFieldSchema",
99+
"TableSchema",
56100
)

google/cloud/bigquery_storage_v1/gapic_metadata.json

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,80 @@
4848
}
4949
}
5050
}
51+
},
52+
"BigQueryWrite": {
53+
"clients": {
54+
"grpc": {
55+
"libraryClient": "BigQueryWriteClient",
56+
"rpcs": {
57+
"AppendRows": {
58+
"methods": [
59+
"append_rows"
60+
]
61+
},
62+
"BatchCommitWriteStreams": {
63+
"methods": [
64+
"batch_commit_write_streams"
65+
]
66+
},
67+
"CreateWriteStream": {
68+
"methods": [
69+
"create_write_stream"
70+
]
71+
},
72+
"FinalizeWriteStream": {
73+
"methods": [
74+
"finalize_write_stream"
75+
]
76+
},
77+
"FlushRows": {
78+
"methods": [
79+
"flush_rows"
80+
]
81+
},
82+
"GetWriteStream": {
83+
"methods": [
84+
"get_write_stream"
85+
]
86+
}
87+
}
88+
},
89+
"grpc-async": {
90+
"libraryClient": "BigQueryWriteAsyncClient",
91+
"rpcs": {
92+
"AppendRows": {
93+
"methods": [
94+
"append_rows"
95+
]
96+
},
97+
"BatchCommitWriteStreams": {
98+
"methods": [
99+
"batch_commit_write_streams"
100+
]
101+
},
102+
"CreateWriteStream": {
103+
"methods": [
104+
"create_write_stream"
105+
]
106+
},
107+
"FinalizeWriteStream": {
108+
"methods": [
109+
"finalize_write_stream"
110+
]
111+
},
112+
"FlushRows": {
113+
"methods": [
114+
"flush_rows"
115+
]
116+
},
117+
"GetWriteStream": {
118+
"methods": [
119+
"get_write_stream"
120+
]
121+
}
122+
}
123+
}
124+
}
51125
}
52126
}
53127
}

google/cloud/bigquery_storage_v1/services/big_query_read/async_client.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ async def create_read_session(
197197
number of pre-filtered rows, so some filters can lead to
198198
lopsided assignments.
199199
200-
Read sessions automatically expire 24 hours after they
200+
Read sessions automatically expire 6 hours after they
201201
are created and do not require manual clean-up by the
202202
caller.
203203
@@ -441,17 +441,7 @@ async def split_read_stream(
441441
# and friendly error handling.
442442
rpc = gapic_v1.method_async.wrap_method(
443443
self._client._transport.split_read_stream,
444-
default_retry=retries.Retry(
445-
initial=0.1,
446-
maximum=60.0,
447-
multiplier=1.3,
448-
predicate=retries.if_exception_type(
449-
core_exceptions.DeadlineExceeded,
450-
core_exceptions.ServiceUnavailable,
451-
),
452-
deadline=600.0,
453-
),
454-
default_timeout=600.0,
444+
default_timeout=None,
455445
client_info=DEFAULT_CLIENT_INFO,
456446
)
457447

google/cloud/bigquery_storage_v1/services/big_query_read/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ def create_read_session(
418418
number of pre-filtered rows, so some filters can lead to
419419
lopsided assignments.
420420
421-
Read sessions automatically expire 24 hours after they
421+
Read sessions automatically expire 6 hours after they
422422
are created and do not require manual clean-up by the
423423
caller.
424424

google/cloud/bigquery_storage_v1/services/big_query_read/transports/base.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -189,19 +189,7 @@ def _prep_wrapped_messages(self, client_info):
189189
client_info=client_info,
190190
),
191191
self.split_read_stream: gapic_v1.method.wrap_method(
192-
self.split_read_stream,
193-
default_retry=retries.Retry(
194-
initial=0.1,
195-
maximum=60.0,
196-
multiplier=1.3,
197-
predicate=retries.if_exception_type(
198-
core_exceptions.DeadlineExceeded,
199-
core_exceptions.ServiceUnavailable,
200-
),
201-
deadline=600.0,
202-
),
203-
default_timeout=600.0,
204-
client_info=client_info,
192+
self.split_read_stream, default_timeout=None, client_info=client_info,
205193
),
206194
}
207195

google/cloud/bigquery_storage_v1/services/big_query_read/transports/grpc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def create_read_session(
253253
number of pre-filtered rows, so some filters can lead to
254254
lopsided assignments.
255255
256-
Read sessions automatically expire 24 hours after they
256+
Read sessions automatically expire 6 hours after they
257257
are created and do not require manual clean-up by the
258258
caller.
259259

google/cloud/bigquery_storage_v1/services/big_query_read/transports/grpc_asyncio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def create_read_session(
256256
number of pre-filtered rows, so some filters can lead to
257257
lopsided assignments.
258258
259-
Read sessions automatically expire 24 hours after they
259+
Read sessions automatically expire 6 hours after they
260260
are created and do not require manual clean-up by the
261261
caller.
262262
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2020 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+
#
16+
from .client import BigQueryWriteClient
17+
from .async_client import BigQueryWriteAsyncClient
18+
19+
__all__ = (
20+
"BigQueryWriteClient",
21+
"BigQueryWriteAsyncClient",
22+
)

0 commit comments

Comments
 (0)