Skip to content
Browse files
feat: add BigQueryWriteClient where append_rows returns a helper …
…for writing rows (#284)

* WIP: write client sample

* add sample with nullable types

* add schema for all supported types

* add complex types to code sample

* refactor sample so that it can be tested

* make test assertions more thorough

* fix lint error

* remove done TODO

* address reviewer comments

* fix tag mismatch

* test on multiple regions

* correct comments about why offset exists

* upgrade g-c-b

* WIP: invert stream using BiDi class

* WIP: attempt to use Future for send instead

* WIP: use futures, populated by background consumer

* make sure stream is actually open before returning from open

* copy close implementation from pub/sub

* support extra metadata

* process exceptions, add open timeout

* sort imports

* WIP: unit tests

* drain futures when stream closes

* update docs

* add callbacks to detect when a stream fails

* add unit tests

* add sleep to loop waiting for RPC to be active

* don't freeze if initial RPC fails

* add needed initializations so done() functions

* fail fast when there is a problem with the initial request

* don't inherit concurrent.futures

It's unnecessary and kept resulting in stuff getting stuck.

* add unit test for open timeout

* 🦉 Updates from OwlBot


* add manual client to docs

* typo in sample comments

* force timeout and metadata to be kwargs

* unify interface for sending row data

* pull stream name from merged request

* require newer proto-plus for copy_from method

Co-authored-by: Owl Bot <gcf-owl-bot[bot]>
  • Loading branch information
tswast and gcf-owl-bot[bot] committed Sep 10, 2021
1 parent c7ac698 commit 2461f63d37f707c2d634a95d87b8ffc3e4af3686
@@ -4,3 +4,7 @@ Bigquery Storage v1beta2 API Library
.. automodule::

.. automodule::
@@ -30,10 +30,15 @@ class BigQueryReadClient(client.BigQueryReadClient):
__doc__ = client.BigQueryReadClient.__doc__

class BigQueryWriteClient(client.BigQueryWriteClient):
__doc__ = client.BigQueryWriteClient.__doc__

__all__ = (
@@ -19,12 +19,14 @@
This is the base from which all interactions with the API occur.

from __future__ import absolute_import

import google.api_core.gapic_v1.method
import google.api_core.retry

from import reader
from import big_query_read
from import (

@@ -135,3 +137,7 @@ def read_rows(
{"retry": retry, "timeout": timeout, "metadata": metadata},

class BigQueryWriteClient(big_query_write.BigQueryWriteClient):
__doc__ = big_query_write.BigQueryWriteClient.__doc__
@@ -0,0 +1,17 @@
# Copyright 2021 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# See the License for the specific language governing permissions and
# limitations under the License.

class StreamClosedError(Exception):
"""Operation not supported while stream is closed."""

0 comments on commit 2461f63

Please sign in to comment.