Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add default_missing_value_interpretation field; indicate KMS_SERVICE_ERROR is retryable #637

Merged
merged 4 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion google/cloud/bigquery_storage_v1/types/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,20 @@ class AppendRowsRequest(proto.Message):

Currently, field name can only be top-level column name,
can't be a struct field path like 'foo.bar'.
default_missing_value_interpretation (google.cloud.bigquery_storage_v1.types.AppendRowsRequest.MissingValueInterpretation):
Optional. Default missing value interpretation for all
columns in the table. When a value is specified on an
``AppendRowsRequest``, it is applied to all requests on the
connection from that point forward, until a subsequent
``AppendRowsRequest`` sets it to a different value.
``missing_value_interpretation`` can override
``default_missing_value_interpretation``. For example, if
you want to write ``NULL`` instead of using default values
for some columns, you can set
``default_missing_value_interpretation`` to
``DEFAULT_VALUE`` and at the same time, set
``missing_value_interpretations`` to ``NULL_VALUE`` on those
columns.
"""

class MissingValueInterpretation(proto.Enum):
Expand Down Expand Up @@ -521,6 +535,11 @@ class ProtoData(proto.Message):
number=7,
enum=MissingValueInterpretation,
)
default_missing_value_interpretation: MissingValueInterpretation = proto.Field(
proto.ENUM,
number=8,
enum=MissingValueInterpretation,
)


class AppendRowsResponse(proto.Message):
Expand Down Expand Up @@ -825,7 +844,7 @@ class StorageErrorCode(proto.Enum):
customer-managed encryption key.
KMS_SERVICE_ERROR (13):
Key Management Service (KMS) service returned
an error.
an error, which can be retried.
KMS_PERMISSION_DENIED (14):
Permission denied while using
customer-managed encryption key.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@

class BigQueryWriteAsyncClient:
"""BigQuery Write API.

The Write API can be used to write data to BigQuery.

The `google.cloud.bigquery.storage.v1
API </bigquery/docs/reference/storage/rpc/google.cloud.bigquery.storage.v1>`__
should be used instead of the v1beta2 API for BigQueryWrite
operations.
"""

_client: BigQueryWriteClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ def get_transport_class(

class BigQueryWriteClient(metaclass=BigQueryWriteClientMeta):
"""BigQuery Write API.

The Write API can be used to write data to BigQuery.

The `google.cloud.bigquery.storage.v1
API </bigquery/docs/reference/storage/rpc/google.cloud.bigquery.storage.v1>`__
should be used instead of the v1beta2 API for BigQueryWrite
operations.
"""

@staticmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,14 @@ class BigQueryWriteGrpcTransport(BigQueryWriteTransport):
"""gRPC backend transport for BigQueryWrite.

BigQuery Write API.

The Write API can be used to write data to BigQuery.

The `google.cloud.bigquery.storage.v1
API </bigquery/docs/reference/storage/rpc/google.cloud.bigquery.storage.v1>`__
should be used instead of the v1beta2 API for BigQueryWrite
operations.

This class defines the same methods as the primary client, so the
primary client can load the underlying transport implementation
and call it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ class BigQueryWriteGrpcAsyncIOTransport(BigQueryWriteTransport):
"""gRPC AsyncIO backend transport for BigQueryWrite.

BigQuery Write API.

The Write API can be used to write data to BigQuery.

The `google.cloud.bigquery.storage.v1
API </bigquery/docs/reference/storage/rpc/google.cloud.bigquery.storage.v1>`__
should be used instead of the v1beta2 API for BigQueryWrite
operations.

This class defines the same methods as the primary client, so the
primary client can load the underlying transport implementation
and call it.
Expand Down
2 changes: 1 addition & 1 deletion scripts/fixup_bigquery_storage_v1_keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def partition(
class bigquery_storageCallTransformer(cst.CSTTransformer):
CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata')
METHOD_TO_PARAMS: Dict[str, Tuple[str]] = {
'append_rows': ('write_stream', 'offset', 'proto_rows', 'trace_id', 'missing_value_interpretations', ),
'append_rows': ('write_stream', 'offset', 'proto_rows', 'trace_id', 'missing_value_interpretations', 'default_missing_value_interpretation', ),
'batch_commit_write_streams': ('parent', 'write_streams', ),
'create_read_session': ('parent', 'read_session', 'max_stream_count', 'preferred_min_stream_count', ),
'create_write_stream': ('parent', 'write_stream', ),
Expand Down