Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit f65d45a

Browse files
committed
Minor change, address comments
1 parent 9132e80 commit f65d45a

5 files changed

Lines changed: 18 additions & 24 deletions

File tree

google/cloud/bigtable/data/_async/client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
Set,
2424
Sequence,
2525
TYPE_CHECKING,
26-
Union,
2726
)
2827

2928
import abc
@@ -660,7 +659,7 @@ async def execute_query(
660659
DeadlineExceeded,
661660
ServiceUnavailable,
662661
),
663-
column_info: dict[str, Union[Message, EnumTypeWrapper]] | None = None,
662+
column_info: dict[str, Message | EnumTypeWrapper] | None = None,
664663
) -> "ExecuteQueryIteratorAsync":
665664
"""
666665
Executes an SQL query on an instance.

google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
Sequence,
2222
Tuple,
2323
TYPE_CHECKING,
24-
Union,
2524
)
2625
from google.api_core import retry as retries
2726
from google.protobuf.message import Message
@@ -90,7 +89,7 @@ def __init__(
9089
operation_timeout: float,
9190
req_metadata: Sequence[Tuple[str, str]] = (),
9291
retryable_excs: Sequence[type[Exception]] = (),
93-
column_info: dict[str, Union[Message, EnumTypeWrapper]] | None = None,
92+
column_info: dict[str, Message | EnumTypeWrapper] | None = None,
9493
) -> None:
9594
"""
9695
Collects responses from ExecuteQuery requests and parses them into QueryResultRows.

google/cloud/bigtable/data/execute_query/_query_result_parsing_utils.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
# limitations under the License.
1414
from __future__ import annotations
1515

16-
from typing import Any, Callable, Dict, Type, Union, Optional
17-
from typing_extensions import TypeAlias
16+
from typing import Any, Callable, Dict, Type, Optional, Union
1817

1918
from google.protobuf.message import Message
2019
from google.protobuf.internal.enum_type_wrapper import EnumTypeWrapper
@@ -44,8 +43,8 @@ def _parse_array_type(
4443
value: PBValue,
4544
metadata_type: SqlType.Array,
4645
column_name: str | None,
47-
column_info: dict[str, Union[Message, EnumTypeWrapper]] | None = None,
48-
) -> Any:
46+
column_info: dict[str, Message | EnumTypeWrapper] | None = None,
47+
) -> list[Any]:
4948
"""
5049
used for parsing an array represented as a protobuf to a python list.
5150
"""
@@ -63,8 +62,8 @@ def _parse_map_type(
6362
value: PBValue,
6463
metadata_type: SqlType.Map,
6564
column_name: str | None,
66-
column_info: dict[str, Union[Message, EnumTypeWrapper]] | None = None,
67-
) -> Any:
65+
column_info: dict[str, Message | EnumTypeWrapper] | None = None,
66+
) -> dict[Any, Any]:
6867
"""
6968
used for parsing a map represented as a protobuf to a python dict.
7069
@@ -104,7 +103,7 @@ def _parse_struct_type(
104103
value: PBValue,
105104
metadata_type: SqlType.Struct,
106105
column_name: str | None,
107-
column_info: dict[str, Union[Message, EnumTypeWrapper]] | None = None,
106+
column_info: dict[str, Message | EnumTypeWrapper] | None = None,
108107
) -> Struct:
109108
"""
110109
used for parsing a struct represented as a protobuf to a
@@ -138,7 +137,7 @@ def _parse_timestamp_type(
138137
value: PBValue,
139138
metadata_type: SqlType.Timestamp,
140139
column_name: str | None,
141-
column_info: dict[str, Union[Message, EnumTypeWrapper]] | None = None,
140+
column_info: dict[str, Message | EnumTypeWrapper] | None = None,
142141
) -> DatetimeWithNanoseconds:
143142
"""
144143
used for parsing a timestamp represented as a protobuf to DatetimeWithNanoseconds
@@ -150,7 +149,7 @@ def _parse_proto_type(
150149
value: PBValue,
151150
metadata_type: SqlType.Proto,
152151
column_name: str | None,
153-
column_info: dict[str, Union[Message, EnumTypeWrapper]] | None = None,
152+
column_info: dict[str, Message | EnumTypeWrapper] | None = None,
154153
) -> Message | bytes:
155154
"""
156155
Parses a serialized protobuf message into a Message object using type information
@@ -188,7 +187,7 @@ def _parse_enum_type(
188187
value: PBValue,
189188
metadata_type: SqlType.Enum,
190189
column_name: str | None,
191-
column_info: dict[str, Union[Message, EnumTypeWrapper]] | None = None,
190+
column_info: dict[str, Message | EnumTypeWrapper] | None = None,
192191
) -> int | str:
193192
"""
194193
Parses an integer value into a Protobuf enum name string using type information
@@ -221,7 +220,7 @@ def _parse_enum_type(
221220
return value.int_value
222221

223222

224-
ParserCallable: TypeAlias = Callable[
223+
ParserCallable = Callable[
225224
[PBValue, Any, Optional[str], Optional[Dict[str, Union[Message, EnumTypeWrapper]]]],
226225
Any,
227226
]
@@ -240,7 +239,7 @@ def _parse_pb_value_to_python_value(
240239
value: PBValue,
241240
metadata_type: SqlType.Type,
242241
column_name: str | None,
243-
column_info: dict[str, Union[Message, EnumTypeWrapper]] | None = None,
242+
column_info: dict[str, Message | EnumTypeWrapper] | None = None,
244243
) -> Any:
245244
"""
246245
used for converting the value represented as a protobufs to a python object.

google/cloud/bigtable/data/execute_query/_reader.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
Iterable,
2121
Optional,
2222
Sequence,
23-
Union,
2423
)
2524
from abc import ABC, abstractmethod
2625
from google.protobuf.message import Message
@@ -61,7 +60,7 @@ def consume(
6160
self,
6261
batches_to_consume: List[bytes],
6362
metadata: Metadata,
64-
column_info: dict[str, Union[Message, EnumTypeWrapper]] | None = None,
63+
column_info: dict[str, Message | EnumTypeWrapper] | None = None,
6564
) -> Optional[Iterable[T]]:
6665
"""This method receives a list of batches of bytes to be parsed as ProtoRows messages.
6766
It then uses the metadata to group the values in the parsed messages into rows. Returns
@@ -101,7 +100,7 @@ def _construct_query_result_row(
101100
self,
102101
values: Sequence[PBValue],
103102
metadata: Metadata,
104-
column_info: dict[str, Union[Message, EnumTypeWrapper]] | None = None,
103+
column_info: dict[str, Message | EnumTypeWrapper] | None = None,
105104
) -> QueryResultRow:
106105
result = QueryResultRow()
107106
columns = metadata.columns
@@ -121,7 +120,7 @@ def consume(
121120
self,
122121
batches_to_consume: List[bytes],
123122
metadata: Metadata,
124-
column_info: dict[str, Union[Message, EnumTypeWrapper]] | None = None,
123+
column_info: dict[str, Message | EnumTypeWrapper] | None = None,
125124
) -> Optional[Iterable[QueryResultRow]]:
126125
num_columns = len(metadata.columns)
127126
rows = []

google/cloud/bigtable/data/execute_query/_sync_autogen/execute_query_iterator.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616
# This file is automatically generated by CrossSync. Do not edit manually.
1717

1818
from __future__ import annotations
19-
from typing import Any, Dict, Optional, Sequence, Tuple, TYPE_CHECKING, Union
19+
from typing import Any, Dict, Optional, Sequence, Tuple, TYPE_CHECKING
2020
from google.api_core import retry as retries
21-
from google.protobuf.message import Message
22-
from google.protobuf.internal.enum_type_wrapper import EnumTypeWrapper
2321
from google.cloud.bigtable.data.execute_query._byte_cursor import _ByteCursor
2422
from google.cloud.bigtable.data._helpers import (
2523
_attempt_timeout_generator,
@@ -65,7 +63,7 @@ def __init__(
6563
operation_timeout: float,
6664
req_metadata: Sequence[Tuple[str, str]] = (),
6765
retryable_excs: Sequence[type[Exception]] = (),
68-
column_info: dict[str, Union[Message, EnumTypeWrapper]] | None = None,
66+
column_info: Dict[str, Any] | None = None,
6967
) -> None:
7068
"""Collects responses from ExecuteQuery requests and parses them into QueryResultRows.
7169

0 commit comments

Comments
 (0)