Skip to content

Commit

Permalink
feat: add table sampling to ReadAPI v1 (#596)
Browse files Browse the repository at this point in the history
* feat: add table sampling to ReadAPI v1
feat: add storage error codes for KMS

PiperOrigin-RevId: 534092654

Source-Link: googleapis/googleapis@adcd87e

Source-Link: googleapis/googleapis-gen@53f03dc
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTNmMDNkY2QyYWUwZDg2ODMyZDg3YTUzMGFhNTM4YjlkYWViZjJiMCJ9

* 🦉 Updates from OwlBot post-processor

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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored May 24, 2023
1 parent 98e976a commit ff1f064
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
20 changes: 20 additions & 0 deletions google/cloud/bigquery_storage_v1/types/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,21 @@ class StorageErrorCode(proto.Enum):
Offset already exists.
OFFSET_OUT_OF_RANGE (9):
Offset out of range.
CMEK_NOT_PROVIDED (10):
Customer-managed encryption key (CMEK) not
provided for CMEK-enabled data.
INVALID_CMEK_PROVIDED (11):
Customer-managed encryption key (CMEK) was
incorrectly provided.
CMEK_ENCRYPTION_ERROR (12):
There is an encryption error while using
customer-managed encryption key.
KMS_SERVICE_ERROR (13):
Key Management Service (KMS) service returned
an error.
KMS_PERMISSION_DENIED (14):
Permission denied while using
customer-managed encryption key.
"""
STORAGE_ERROR_CODE_UNSPECIFIED = 0
TABLE_NOT_FOUND = 1
Expand All @@ -801,6 +816,11 @@ class StorageErrorCode(proto.Enum):
SCHEMA_MISMATCH_EXTRA_FIELDS = 7
OFFSET_ALREADY_EXISTS = 8
OFFSET_OUT_OF_RANGE = 9
CMEK_NOT_PROVIDED = 10
INVALID_CMEK_PROVIDED = 11
CMEK_ENCRYPTION_ERROR = 12
KMS_SERVICE_ERROR = 13
KMS_PERMISSION_DENIED = 14

code: StorageErrorCode = proto.Field(
proto.ENUM,
Expand Down
15 changes: 15 additions & 0 deletions google/cloud/bigquery_storage_v1/types/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,16 @@ class TableReadOptions(proto.Message):
output format
This field is a member of `oneof`_ ``output_format_serialization_options``.
sample_percentage (float):
Optional. Specifies a table sampling percentage.
Specifically, the query planner will use TABLESAMPLE SYSTEM
(sample_percentage PERCENT). This samples at the file-level.
It will randomly choose for each file whether to include
that file in the sample returned. Note, that if the table
only has one file, then TABLESAMPLE SYSTEM will select that
file and return all returnable rows contained within.
This field is a member of `oneof`_ ``_sample_percentage``.
"""

selected_fields: MutableSequence[str] = proto.RepeatedField(
Expand All @@ -252,6 +262,11 @@ class TableReadOptions(proto.Message):
oneof="output_format_serialization_options",
message=avro.AvroSerializationOptions,
)
sample_percentage: float = proto.Field(
proto.DOUBLE,
number=5,
optional=True,
)

name: str = proto.Field(
proto.STRING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-bigquery-storage",
"version": "2.19.1"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-bigquery-storage",
"version": "2.19.1"
"version": "0.1.0"
},
"snippets": [
{
Expand Down

0 comments on commit ff1f064

Please sign in to comment.